синтаксический анализ следующей схемы xml приводит к этой ошибке:
атрибут элемента: ошибка синтаксического анализатора схем: атрибут decl. 'current-state', атрибут 'type': значение QName 'covered-state' не разрешается в (n) простое определение типа. Не удалось скомпилировать схему WXS memory.xsd
Вот ответственный код:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com">
<xsd:simpleType name="covered-state">
<xsd:union>
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:enumeration value="0"/>
<xsd:enumeration value="1"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="COVERED"/>
<xsd:enumeration value="UNCOVERED"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:union>
</xsd:simpleType>
<xsd:complexType name="MemoryCard">
<xsd:attribute name="current-state" type="covered-state" use="required"/> <!-- here i get the error -->
</xsd:complexType>
</xsd:schema>
Итак, что это должно сделать, так это объединить перечисление строк и целых чисел, чтобы файл xml принимал «0», «1», «COVERED» или «UNCOVERED» для текущего состояния атрибута.
Может ли кто-нибудь указать мне в правильном направлении? Спасибо!