tackyjan
June 25th, 2011, 12:16 AM
When defining a simple type in XML Schema, such as a string enumeration, the facets that restrict the simple type can be inconsistent with respect to one another.
For example, the one could define all the enumeration elements to be of length 2-3 but then also define the maxLength facet to be 4. (See below.)
<xs:simpleType name="SalutationEnum">
<xs:restriction base="xs:string">
<xs:minLength value="4" />
<xs:enumeration value="Mr" />
<xs:enumeration value="Ms" />
<xs:enumeration value="Mrs" />
</xs:restriction>
</xs:simpleType>
Altova XML spy does not complain when validating the schema, however, there is obviously a problem.
This complicates my code because now I have to check that all declared facets are self-consistent.
I am not sure if the terminology I am using is correct but I think you will get the idea.
Anyway, can someone suggest an easy way to check for these 'issues' when parsing the schema. I have reached a brain-lock state and can't move on! :)
Thank you!!
For example, the one could define all the enumeration elements to be of length 2-3 but then also define the maxLength facet to be 4. (See below.)
<xs:simpleType name="SalutationEnum">
<xs:restriction base="xs:string">
<xs:minLength value="4" />
<xs:enumeration value="Mr" />
<xs:enumeration value="Ms" />
<xs:enumeration value="Mrs" />
</xs:restriction>
</xs:simpleType>
Altova XML spy does not complain when validating the schema, however, there is obviously a problem.
This complicates my code because now I have to check that all declared facets are self-consistent.
I am not sure if the terminology I am using is correct but I think you will get the idea.
Anyway, can someone suggest an easy way to check for these 'issues' when parsing the schema. I have reached a brain-lock state and can't move on! :)
Thank you!!