Override xsd element

I am trying to override the element definition contained in external xsd (which I cannot change) that looks like this:

<xsd:element name="view-controller">
    <xsd:complexType>
        <xsd:attribute name="path" type="xsd:string" use="required" />
        <xsd:attribute name="view-name" type="xsd:string" />
    </xsd:complexType>
</xsd:element>

This defines elements such as:

<mvc:view-controller path="/path" view-name="server/view/etc" />

How to extend it so that I can create elements with two additional attributes (foo and bar)?
Below is an example for the final result:

<mvc:view-controller path="/path" view-name="server/view/etc" foo="stuff" bar="more stuff" />

What I tried:

<xsd:redefine schemaLocation="http://www.domain.org/schema/correct-path.xsd">
    <xsd:simpleType name="view-controller">
        <xsd:complexContent>
            <xsd:extension base="view-controller">
                <xsd:attribute name="foo" type="xsd:string" />
                <xsd:attribute name="bar" type="xsd:string" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:simpleType>
</xsd:redefine>

However, this does not work.
I can't seem to find any resource detailing how to redefine the attributes xsd:element, which I believe are the problem here.

Please comment if additional information is required.

+3
source share
2 answers

complexContent simpleType, .

, , : simpleType, complexType, group, attributeGroup. , . , , , , .

. http://www.w3.org/TR/xmlschema-0/#Redefine.

+2

@Razor, , xsd, xsd, ?

, , ! , definition already exists ..

0

Source: https://habr.com/ru/post/1775670/


All Articles