私はいくつかの他の子タイプの基本タイプであるchange
要素タイプのリストを保持する要素タイプを構築しようとしています。 C++コードを生成するCodeSynthesisを使用して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>
イム」:私はこのコードを得ました。
ここでは、さまざまなタイプへのアクセスを明確に定義しているので、これは残念です。私が望むのは、もっとシンプルなものだと思います。
変更リスト私は変化の異なるサブタイプのための異なるタグを持ってすることはできません
<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