In the XSD, there are two elements, A and B. They are siblings.
在XSD中,有两个元素,A和B.它们是兄弟姐妹。
A can have a value of either "1" or "2". B can have a value of either "one" or "two".
A的值可以是“1”或“2”。 B可以具有“一”或“两”的值。
I want to restrict this, however, so that only "1-one" and "2-two" are valid combinations, not "1-two" or "2-one". Is there a way of doing that in the XSD?
但是,我想限制它,因此只有“1-one”和“2-two”才是有效组合,而不是“1-two”或“2-one”。有没有办法在XSD中这样做?
1 个解决方案
#1
2
Schematron can be used to define such co-occurrence constraints. You can find some introductory articles here:
Schematron可用于定义此类共现约束。你可以在这里找到一些介绍性文章:
- Improving XML Document Validation with Schematron
- Schematron: XML Structure Validation Language Using Patterns in Trees
使用Schematron改进XML文档验证
Schematron:使用树中的模式的XML结构验证语言
#1
2
Schematron can be used to define such co-occurrence constraints. You can find some introductory articles here:
Schematron可用于定义此类共现约束。你可以在这里找到一些介绍性文章:
- Improving XML Document Validation with Schematron
- Schematron: XML Structure Validation Language Using Patterns in Trees
使用Schematron改进XML文档验证
Schematron:使用树中的模式的XML结构验证语言