开发者

Validate specific XML with XSD

开发者 https://www.devze.com 2023-03-11 18:13 出处:网络
We have specific XML that has specific structure: <root> <element type=”a”> <value>someValueA</value>

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消