添加"选择"的组合的正确方法是什么?元素到xsd。
例如,如果选择在哪里(并且只允许以下一项):
以下是我尝试过的XSD,但生成时收到的错误是:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema ...>
<xs:element name="AddNewPersonRequestMessage">
<xs:complexType>
<xs:sequence>
...
<xs:choice>
<xs:group ref="group1" />
<xs:group ref="group2" />
<xs:group ref="group3" />
</xs:choice>
..
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="WorkNumber" type="xs:unsignedInt" />
<xs:element name="CellNumber" type="xs:unsignedInt" />
<xs:element name="HomeNumber" type="xs:unsignedInt" />
<xs:group name="group1">
<xs:sequence>
<xs:element ref="CellNumber" />
</xs:sequence>
</xs:group>
<xs:group name="group2">
<xs:sequence>
<xs:element ref="WorkNumber" />
<xs:element ref="HomeNumber" />
</xs:sequence>
</xs:group>
<xs:group name="group3">
<xs:sequence>
<xs:element ref="CellNumber" />
<xs:element ref="HomeNumber" />
</xs:sequence>
</xs:group>
</xs:schema>
XSD:
[[[1 if z == x else 0 for z in y] for y in one] for x in word]
答案 0 :(得分:1)
您可以通过重新排列逻辑来避免Unique Particle Attribution违规。
观察
的分离可以改写为
并将您的XSD重写为
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="AddNewPersonRequestMessage">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:group ref="group2" />
<xs:group ref="group3" />
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="WorkNumber" type="xs:unsignedInt" />
<xs:element name="CellNumber" type="xs:unsignedInt" />
<xs:element name="HomeNumber" type="xs:unsignedInt" />
<xs:group name="group2">
<xs:sequence>
<xs:element ref="WorkNumber" />
<xs:element ref="HomeNumber" />
</xs:sequence>
</xs:group>
<xs:group name="group3">
<xs:sequence>
<xs:element ref="CellNumber"/>
<xs:element ref="HomeNumber" minOccurs="0"/>
</xs:sequence>
</xs:group>
</xs:schema>
并且您将拥有一个不违反独特粒子归因的等效表单。