XSD problem , need an attribute which contains the number of child elements

R

raulverde

I have an element declared like this :

<xs:element name="class">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="className" minOccurs="0" />
<xs:element name="students" type="student" minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>

Now i need an attirbute in "students" ... lets call it "totalStudents"
which would contain the number of students...is it possible ?
 
G

George Bina

Hi,

You can add an attribute and specify the total number of students there
but XML Schema does not have a way to check that the value of that
attribute represents the number of students. You can check that either
at application level or using Schematron embedded in XML Schema.

Best Regards,
George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top