Validate specific XML with XSD
We have specific XML that has specific structure:
<root>
<element type=”a”>
<value>someValueA</value>
</element>
<element type=”b”>
<value>someValueB</value>
</element>
</root>
Is it possible to validate it usi开发者_开发百科ng XSD in such a way that the element with type “a” is required and that of type “b” is not required?
In XSD 1.0 you can't apply different constraints to different sibling elements that have the same element name.
It looks like you need XSD 1.1 assertions - available now in Saxon and Xerces.
精彩评论