기본 유형에서 요소를 파생시키고 싶습니다. 이 기본 유형 (Entity라고 함)에는 id 속성이 있습니다. 파생 요소의 경우이 속성에 제한을 추가하려고합니다 (파생 된 다른 Entity 요소에 대한 다른 제한 사항).확장 유형의 속성을 제한하는 방법
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="Entity">
<xs:attribute name="id">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z]+[0-9]+"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:element name="someEntity">
<xs:complexType>
<xs:complexContent>
<xs:extension base="Entity">
<xs:sequence>
<xs:element name="someAdditionalElement"/>
</xs:sequence>
<!-- I would like to restrict the attribute "id" for this entity to e.g. the pattern "SOME[0-9]+" -->
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="otherEntity">
<xs:complexType>
<xs:complexContent>
<xs:extension base="Entity">
<xs:sequence>
<xs:element name="otherAdditionalElement"/>
</xs:sequence>
<!-- I would like to restrict the attribute "id" for this entity to a differtnt pattern like e.g. "OTHER[0-9]+" -->
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>
가능합니까? 그렇다면 어떻게 할 수 있습니까?
엔터티 유형에 대한 제한 패턴이 불완전 ([A-Z] +) - [A-Z] + [0-9] + 또는 [A-Z0-9]로되어 있습니다. 나는 이것을 바로 잡았다. 포괄적이고 유용한 답변을 주셔서 감사합니다. – yaccob