Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XML query - schema included

Reply
Thread Tools

XML query - schema included

 
 
Colin McGuire
Guest
Posts: n/a
 
      08-20-2003
Hello, I have the following schema defined to validate XML that has
lots of students in a school, and each student has an age and a
studentID.
Here is my schema - I cannot figure out how to put in the schema that
the studentID must be unique (two students cannot have the same ID).

<xsd:schema xmlnssd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="school">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="student" minOccurs="1" maxOccurs="3260">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="age" type="xsd:integer"/>
<xsd:element name="studentID" type="xsd:integer"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>



I am thinking to make the studentID unique I have to put this in (I
dont know whether this is correct but think it is), but I do now know
where.


<xsd:unique name="UniqueStudentConstraint">
<xs:selector xpath="student"/>
<xs:field xpath="@studentID"/>
</xsd:unique>


Thank you
Colin
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
web.xml / XML schema issue, why do some XML schema attributes disappear asciz@starmail.com Java 3 02-20-2007 09:56 AM
Validation with XSD using XML::LibXML::Schema, and XML::Validator::Schema huntingseasonson@gmail.com Perl Misc 5 11-29-2006 12:37 PM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
XML Schema to XML Schema Conversion Hari Om XML 1 03-02-2004 09:04 PM
XML schema regular expressions question and recommended XML Schema book Fred Smith XML 1 02-05-2004 11:12 AM



Advertisments