2
を作成するように、私は、次のXMLスキーマXMLスキーマ:XSD拡張:選択肢の労働組合(シーケンスではありませんが)
<xsd:complexType name="SimpleThing">
<xsd:choice maxOccurs="unbounded">
<xsd:group ref="simpleContent" />
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="ExtendedThing">
<xsd:complexContent>
<xsd:extension base="SimpleThing">
<xsd:choice maxOccurs="unbounded">
<xsd:element name="qux" />
</xsd:choice>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:group name="simpleContent">
<xsd:choice>
<xsd:element name="foo" />
<xsd:element name="bar" />
</xsd:choice>
</xsd:group>
<xsd:group name="extendedContent">
<xsd:choice>
<xsd:group ref="simpleContent" />
<xsd:element name="qux" />
</xsd:choice>
</xsd:group>
<xsd:element name="root" type="ExtendedThing" />
を持つ選択肢を、私は任意の順序でfoo
、bar
とqux
を格納するタイプExtendedThing
をしたいと思います。しかし、このスキーマではqux
はfoo
とbar
の後に来なければなりません。なぜなら、スーパータイプの選択とサブタイプの選択から選択の和集合ではなくシーケンスが作成されるからです。 Unique Particle Attribution制約に違反しているため
代替、
<xsd:complexType name="ExtendedThing">
<xsd:complexContent>
<xsd:extension base="SimpleThing">
<xsd:group ref="extendedContent" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
でExtendedThing
のための型定義を交換すると、いずれかの動作しません。
この問題の解決策はありますか。新しいタイプのコンテンツが(新しい順番の)要素のセットであるように、別のタイプの拡張であるXMLスキーマで型を作成することは不可能ですか?スーパータイプの内容のスーパーセット?
参照:http://stackoverflow.com/questions/9008622/how-to-extend-a-choice-complextype-without-sequencing-the-choice – albciff