Дизайн наследования XSD

У меня в xsd вот такое:

<xsd:simpleType name = "line_action">
    <xsd:restriction base = "xsd:string">
        <xsd:enumeration value = "add"/>
        <xsd:enumeration value = "delete"/>
        <xsd:enumeration value = "remove"/>
        <xsd:enumeration value = "suspend"/>
        <xsd:enumeration value = "restore"/>
        <xsd:enumeration value = "update"/>
    </xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name = "action_enum_5">
    <xsd:restriction base = "tns:line_action">
        <xsd:enumeration value = "add"/>
        <xsd:enumeration value = "remove"/>
    </xsd:restriction>
</xsd:simpleType>


    <xsd:element name = "call_forward_dont_answer">
        <xsd:complexType>
            <xsd:complexContent>
                <xsd:restriction base = "tns:basic_option">
                    <xsd:sequence>
                        <xsd:element name = "paths" type = "tns:path_type"/>
                        <xsd:element name = "number_of_rings" type = "tns:number_of_rings_type"/>
                        <xsd:element name = "ring_to_number" type = "tns:telephone_number_type"/>
                    </xsd:sequence>
                    <xsd:attribute name = "action" type = "tns:action_enum_5"/>
                </xsd:restriction>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>

Итак, для call_forward_dont_answer я хочу расширить базовую опцию и еще несколько элементов / полей, но тогда действие должно быть только добавлением и удалением. Если я сделаю расширение, я не смогу изменить тип атрибута, но если я сделаю ограничение, я не смогу добавлять новые элементы / поля?

Что мне делать?

Принципы ООП в JavaScript
Принципы ООП в JavaScript
Парадигма объектно-ориентированного программирования имеет 4 основных принципа,
2
0
4 291
1
Перейти к ответу Данный вопрос помечен как решенный

Ответы 1

Ответ принят как подходящий

Ну исправил сам. Сделав ограничение, а затем расширив это ограничение.

<xsd:simpleType name = "line_action">
    <xsd:restriction base = "xsd:string">
        <xsd:enumeration value = "add"/>
        <xsd:enumeration value = "delete"/>
        <xsd:enumeration value = "remove"/>
        <xsd:enumeration value = "suspend"/>
        <xsd:enumeration value = "restore"/>
        <xsd:enumeration value = "update"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:complexType name = "super_option">
    <xsd:attribute name = "action" type = "tns:line_action"/>
</xsd:complexType>

        <xsd:element name = "call_forward_dont_answer">
            <xsd:complexType>
                <xsd:complexContent>
                    <xsd:extension base = "tns:updatable_option">
                        <xsd:sequence>
                            <xsd:element name = "paths" type = "tns:path_type"/>
                            <xsd:element name = "number_of_rings" type = "tns:number_of_rings_type"/>
                            <xsd:element name = "ring_to_number" type = "tns:telephone_number_type"/>
                        </xsd:sequence>
                    </xsd:extension>
                </xsd:complexContent>
            </xsd:complexType>
        </xsd:element>


<xsd:complexType name = "basic_option">
    <xsd:complexContent>
        <xsd:restriction base = "tns:super_option">
            <xsd:attribute name = "action" type = "tns:action_enum_1"/>
        </xsd:restriction>
    </xsd:complexContent>
</xsd:complexType>

<xsd:complexType name = "updatable_option">
    <xsd:complexContent>
        <xsd:restriction base = "tns:super_option">
            <xsd:attribute name = "action" type = "tns:action_enum_5"/>
        </xsd:restriction>
    </xsd:complexContent>
</xsd:complexType>

Другие вопросы по теме