The problem is as follows:
I have the following XML snippet:
The problem is that I can't add both the attribute and the restriction at the same time. The attribute format can only have the values minutes, hours and seconds. The time has the restriction pattern
<xs:element name="time" type="timeType"/> ... <xs:simpleType name="formatType"> <xs:restriction base="xs:string"> <xs:enumeration value="minutes"/> <xs:enumeration value="hours"/> <xs:enumeration value="seconds"/> </xs:restriction> </xs:simpleType> <xs:complexType name="timeType"> <xs:attribute name="format"> <xs:simpleType> <xs:restriction base="formatType"/> </xs:simpleType> </xs:attribute> </xs:complexType>
If I make a complex type of timeType, I can add an attribute, but not the restriction, and if I make a simple type, I can add the restriction but not the attribute. Is there any way to get around this problem. This is not a very strange restriction, or is it?