xsd:限制一个属性大于其他(相对验证)
问题描述:
我正在寻找一种方法来根据伴侣属性valid-from
限制输入属性valid-till
。xsd:限制一个属性大于其他(相对验证)
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="Data">
<xs:sequence>
<xs:element name="material" type="Material" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="id" type="xs:ID" />
<xs:attribute name="valid-from" type="xs:dateTime" />
<xs:attribute name="valid-till" type="xs:dateTime" />
</xs:complexType>
</xs:schema>
我该如何实现这个目标?
答
也许最好的开始方式是做一个网页搜索或者在Stack Overflow上搜索。看到任何或所有
- Is there any way in xml schema to let an attribute always be greater than another one in an xml element?
- Validating the child's age against the parents age in xsd
- XSD assertions conditioned by the existence of attributes
- Restrict attribute value depending on value of another attribute
- XSD: Define attributes based on the value of previous attribute
- XML schema attribute dependancies
或者对 'XSD断言' 搜索,'xsd assert','xsd co-occurrence constraint'。
是的。由于我仅限于xsd-1.0,因此没有解决方案。正如你[提到](http://stackoverflow.com/a/15800181/1791481)。 – mailwurf