I got really excited when I spotted the assertion capability of XML/XSD, then I noticed it is version 1.1, which unfortunately we cannot use.
Is there a way of achieving assertions with 1.0?
Example, we would like for an XSD restriction to be limited to values specified in a separate element within the XML document, not the XSD schema.
With a simple restriction, it might look like:
<xs:element name="recordset">
<xs:complexType>
<xs:sequence>
<xs:element name="record" type="record" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="record">
<xs:sequence>
<xs:element name="tag" type="recordTag" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:simpleType name="recordTag">
<xs:restriction base="xs:string">
<xs:enumeration value="tag1" />
<xs:enumeration value="tag2" />
<xs:enumeration value="tag3" />
</xs:restriction>
</xs:simpleType>
We would have liked that the tag restrictions be specified in the XML, which assertions seemed the way to create validation of these values. Given the below change, an xs:assert element would have gone in on the recordset type comparing the contents of tag from the record to those of the tagDefinitions.
<xs:element name="recordset">
<xs:complexType>
<xs:sequence>
<xs:element name="tags" type="tagDefinitions" minOccurs="1" maxOccurs="1" />
<xs:element name="record" type="record" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="record">
<xs:sequence>
<xs:element name="tag" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="tagDefinitions">
<xs:sequence>
<xs:element name="tag" type="xs:string" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
Is this still possible in XML 1.0?