Using XSD to validate node count

Posted by heath on Stack Overflow See other posts from Stack Overflow or by heath
Published on 2010-04-13T20:50:33Z Indexed on 2010/04/13 20:53 UTC
Read the original article Hit count: 294

Filed under:
|
|

I don't think this is possible but I thought I'd throw it out there. Given this XML:

 <people count="3">
      <person>Bill</person>
      <person>Joe</person>
      <person>Susan</person>
 </people>

Is it possible in an XSD to force the @count attribute value to be the correct count of defined elements (in this case, the person element)? The above example would obviously be correct and the below example would not validate:

 <people count="5">
      <person>Bill</person>
      <person>Joe</person>
      <person>Susan</person>
 </people>

© Stack Overflow or respective owner

Related posts about xsd

Related posts about nodes