問題は次のとおりです。
次の 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 の複合型を作成すると、属性を追加できますが、制限は追加できません。単純型を作成すると、制限を追加できますが、属性は追加できません。この問題を回避する方法はありますか。これは非常に奇妙な制限ではありませんか?