Обязателен ли элемент, если его кратность не указана?

Я пишу библиотеку, которая создает сообщения XML на основе формата сообщений XML, определенного в XSD. Однако у меня есть пара вопросов относительно следующей схемы:

Требуется ли элемент 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>

person bleepzter    schedule 05.01.2012    source источник


Ответы (1)


да. Значение по умолчанию для minOccurs и maxOccurs равно 1, поэтому SOPClass должно встречаться один и только один раз. См. значения XML-схемы minOccurs/maxOccurs по умолчанию

person skaffman    schedule 05.01.2012