开发者

Writing XSD schema: if one field contains "A", then other field should not contain "B". How?

开发者 https://www.devze.com 2022-12-28 22:39 出处:网络
A simple scenario: if one field contains \"A\", then the other field should not contain \"B\". How to write a XSD schema for it.

A simple scenario: if one field contains "A", then the other field should not contain "B". How to write a XSD schema for it. Example:

<root>
<field_1>A</field_1>
<field_2>B</field_2>开发者_如何学运维;
</root>

How to write an XSD schema that imposes restriction on the value of an element, depending on the value of another element?


You cannot do this in XML Schema 1.0 - you need to look elsewhere, like at Schematron or Relax NG for those kinds of validations.

0

精彩评论

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