问题如下:
我有以下 XML 片段:
<time format="minutes">11:60</time>
问题是我不能同时添加属性和限制。属性格式只能具有分钟、小时和秒的值。时间有限制模式\d{2}:\d{2}
<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>
如果我做一个复杂类型的timeType,我可以加一个属性,但不能加限制;如果我做一个简单类型,我可以加限制,但不能加属性。有没有办法解决这个问题。这不是一个很奇怪的限制,不是吗?