Wednesday, 20 July 2011

xs:all vs xs:choice - counter-intuitive but technically correct

imagine you need to validate the following xml piece:
<moo name="duck">hdhdh</moo>
<moo name="suck">flkfkfk</moo>
<moo name="buck">jsjsj</moo>

<moo name="duck">733737</moo>

xs:all will break as it will not allow multiple moo elements
xs:choice maxOccours="unbounded" will work! even though by its name you may assume that it is, well, a CHOICE but saying that max occurs is unbounded it will allow multiple moo elements!

No comments:

Post a Comment