我正在编写一个库,它根据XSD中定义的XML消息格式生成xml消息。但是,我对以下架构有几个问题:
SOPClass
对象中是否需要元素ParticipantObjectIdentificationContents
?
<xs:complexType name="ParticipantObjectIdentificationContents">
<xs:sequence>
<!-- there are other elements here -->
<xs:group ref="DICOMObjectDescriptionContents"/>
<!-- there are other elements here -->
</xs:sequence>
</xs:complexType>
<xs:group name="DICOMObjectDescriptionContents">
<xs:sequence>
<!-- there are other elements here -->
<xs:element ref="SOPClass"/>
<!-- there are other elements here -->
</xs:sequence>
</xs:group>
<xs:element name="SOPClass">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="Instance"/>
</xs:sequence>
<xs:attribute name="UID" type="xs:token"/>
<xs:attribute name="NumberOfInstances" use="required" type="xs:integer"/>
</xs:complexType>
</xs:element>
<xs:element name="Instance">
<xs:complexType>
<xs:attribute name="UID" use="required" type="xs:token"/>
</xs:complexType>
</xs:element>
答案 0 :(得分:5)
是。 minOccurs
和maxOccurs
的默认值为1,因此SOPClass
必须只出现一次。见XML Schema minOccurs / maxOccurs default values