change
他のいくつかの子型の基本型である要素型のリストを保持する要素型を構築しようとしています。私はこのコードを得ました:
<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>
CodeSynthesis を使用して C++ コードを生成しています。
ここでは、さまざまな型へのアクセスを明確に定義しているため、これはやり過ぎに思えます。私が欲しいのは、次のようなもっと単純なものだと思います:
変更のリスト。
<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>
これで、変更のサブタイプごとに異なるタグを付けることができなくなりました。だから私は多分良い解決策は置換グループを使うことだと思った.
しかし、そうすると、特定のサブタイプの属性と要素を使用できなくなります。
元の解決策はそれを行うのに適していますか(子型も取得できる基本型オブジェクトのリストを持っています)?