XML Schema rcase-NameAndTypeOK.3.2.5 invalid

So, I'm trying to create a schema, whereby I use one schema as a reference and never touch and another schema where I can touch, extend, restrict etc. So the problem I'm having now is that I'm faced with a restraint rcase-NameAndTypeOK3.2.5.

<!--Msg -->
<xs:complexType name="Main">
    <xs:complexContent>
        <xs:restriction base="B">
            <xs:sequence>
                <xs:element name="B1" type="BType"/>
                <xs:element name="B2" type="BType"/>
                <xs:element name="B3" type="B3-Type"/>
            </xs:sequence>
        </xs:restriction>
    </xs:complexContent>
</xs:complexType>
<!-- Types -->
<xs:complexType name="B3-Type">
    <xs:complexContent>
        <xs:extension base="BType">
            <xs:sequence>
                <xs:element name="B-4"/>
            </xs:sequence>
        </xs:extension>
    </xs:complexContent>
</xs:complexType>

<!-- Source -->
<xs:complexType name="BType">
    <xs:sequence>
        <xs:element name="B-1"/>
        <xs:element name="B-2"/>
        <xs:element name="B-3"/>
    </xs:sequence>
</xs:complexType>
<xs:complexType name="B">
    <xs:sequence>
        <xs:element name="B1" type="BType"/>
        <xs:element name="B2" type="BType"/>
        <xs:element name="B3" type="BType"/>
    </xs:sequence>
</xs:complexType>

I have a work around, and that is removing the restriction in Main. Is there another workaround without removing the restriction in Main? Is there something I'm doing wrong?

Answers


I don't see another workaround - the problem is that Main as defined is not a restriction nor an extension of B - being that it can contain an element B3 as B but with one extra sub-element B-4.

If you want to have a fixed base schema and then a derived schema with some declaration equal to the base one and some other different probably you should use xsd:redefine


Need Your Help

What is - Single and Multiple Dispatch (in relation to .NET)?

c# multiple-dispatch single-dispatch

Is it the same as overloading, if not, can you please provide and example of each in C#

IE6 rending UL's incorrectly

html css internet-explorer-6 rendering

Sometimes IE6 will render the text of a &lt;ul&gt; list the same color as the background color. If you select it, they show back up, or if you scroll the page up and back down.