A、B、Cの3つの要素があります。スキーマが[A] 、 [B & C] 、または[A & B & C ]のいずれかを選択するXSDを作成したかったのです。
Can anyone please help me to create an xsd for the above option.
前もって感謝します。MK
A、B、Cの3つの要素があります。スキーマが[A] 、 [B & C] 、または[A & B & C ]のいずれかを選択するXSDを作成したかったのです。
Can anyone please help me to create an xsd for the above option.
前もって感謝します。MK
[A]、[B&C]、[A、B&C]のような3つの要素のグループを作成できます。そして、XSDの一部のように、これらのグループから選択してcompleTypeを定義します。検証するかどうかわからない。あるかどうかを確認するためのXSDオーサリングツールがありません。
<xs:group name="Group1">
<xs:sequence>
<xs:element name="A"/>
</xs:sequence>
</xs:group>
<xs:group name="Group2">
<xs:sequence>
<xs:element name="B"/>
<xs:element name="C"/>
</xs:sequence>
</xs:group>
<xs:group name="Group3">
<xs:sequence>
<xs:element name="A"/>
<xs:element name="B"/>
<xs:element name="C"/>
</xs:sequence>
</xs:group>
<xs:complexType name="choice1">
<xs:choice minOccurs="1" maxOccurs="1">
<xs:group ref="Group1" />
<xs:group ref="Group2"/>
<xs:group ref="Group3"/>
</xs:choice>
</xs:complexType>
これはあなたの要求を満たしています。なぜあなたが尋ねたのかを考えてみると、それはおそらくユニークな粒子の属性に関連していたでしょう。以下のオプションのシーケンスは、「仮想」の選択肢として機能します。
<?xml version="1.0" encoding="utf-8" ?>
<!--XML Schema generated by QTAssistant/XML Schema Refactoring (XSR) Module (http://www.paschidev.com)-->
<xsd:schema targetNamespace="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="root">
<xsd:complexType>
<xsd:choice>
<xsd:sequence>
<xsd:element name="A"/>
<xsd:sequence minOccurs="0">
<xsd:element name="B"/>
<xsd:element name="C"/>
</xsd:sequence>
</xsd:sequence>
<xsd:sequence>
<xsd:element name="B"/>
<xsd:element name="C"/>
</xsd:sequence>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>