Tuesday, April 13, 2010

Using XSD to validate node count

Programmer Question

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>


Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails