다른 여러 하위 유형의 기본 유형 인 change
요소 유형의 목록을 유지하는 요소 유형을 작성하려고합니다. 나는이 코드를 가지고있다 :XSD : 다형성 "목록"을 만드는 방법은 무엇입니까?
<xs:complexType name="change_list" >
<xs:annotation>
<xs:documentation>List of changes.</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:choice minOccurs="1" maxOccurs="unbounded" >
<xs:element name="change" type="aos:change" >
<xs:annotation>
<xs:documentation>Generic or specific type of change.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="activate" type="aos:activate" >
<xs:annotation>
<xs:documentation>Change that will activate an element or do nothing if already activated.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="deactivate" type="aos:deactivate" >
<xs:annotation>
<xs:documentation>Change that will deactivate an element or do nothing if already deactivated.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="switch" type="aos:switch" >
<xs:annotation>
<xs:documentation>Change that will activate the element if deactivated or deactivate it if activated.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="transform" type="aos:transform" >
<xs:annotation>
<xs:documentation>
Change that will modify the geometric state of the element
by applying one or several geometric transformations.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:sequence>
Im 'C++ 코드를 생성하기 위해 CodeSynthesis 사용.
자, 여기서 우리는 다른 유형에 대한 액세스를 명확하게 정의하기 때문에 과도한 것처럼 보입니다. 나는 내가 원하는 것이 더 단순한 것 같다고 생각한다.
변경 목록. 나를 변화의 다른 아형에 대해 서로 다른 태그를 허용하지 않는
<xs:sequence>
<xs:choice minOccurs="1" maxOccurs="unbounded" >
<xs:element name="change" type="aos:change" >
<xs:annotation>
<xs:documentation>Generic or specific type of change.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:sequence>
지금. 그래서 좋은 해결책은 substitution group을 사용하는 것일 수 있다고 생각했습니다.
하지만 특정 하위 유형의 속성 및 요소를 사용할 수있는 능력이 느슨합니다.
원래 솔루션이 좋았습니까 (하위 유형을 가질 수있는 기본 유형의 객체 목록이 있음)?
에스? XML 스키마에서 다 형태론을 모델링하는 것이 일반적입니다. – lexicore
아마 내가 틀렸어. 대체 그룹을 사용하는 AFAIK는 일종의 별칭이지, 그렇지? 그런 다음 "변경"태그의 별칭으로 사용할 수 있습니까? 맞습니까? 그런 다음 change-tag-child-element-type-specific 요소와 속성을 사용할 수 없습니다. 나 맞아? – Klaim