XSD extend a complex type

前端 未结 1 1103
旧时难觅i
旧时难觅i 2021-01-20 02:52

I\'m trying to extend an existing complextype in a XSD file.

I have created a new xsd file and included it at the end of all the master XSD files includes.

T

相关标签:
1条回答
  • 2021-01-20 03:48

    If you want to keep the name of the complex type as "Feature_Cadastre_Lot" and extend it with additional content, then you are looking at redefine instead. The net effect is that all references to "Feature_Cadastre_Lot", preexisting and new, will include the newly added content.

    If you want this in some, but not all of the existing content, there is no solution to it (redefine is all or nothing).

    The redefine has the following layout:

    <xs:redefine schemaLocation="must resolve to your XSD">
      <xs:complexType name="Feature_Cadastre_Lot">
        <xs:complexContent>
          <xs:extension base="Feature_Cadastre_Lot">
            <xs:sequence>
                <xs:element name="LMS_ID_1" type="String_32" minOccurs="1" maxOccurs="1" nillable="false">
                    <xs:annotation>
                        <xs:documentation>The Land Management System ID as defined by the LMS Team</xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="LMS_ID_2" type="String_32" minOccurs="1" maxOccurs="1" nillable="false">
                    <xs:annotation>
                        <xs:documentation>The Land Management System ID as defined by the LMS Team</xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:sequence>
          </xs:extension>
        </xs:complexContent>
      </xs:complexType>
    </xs:redefine>
    

    The result will look like this:

    Redefined type

    You can see the highlighted sequence as showing the added content.

    In Visual Studio 2010, the content also shows ok:

    VS2010 redefine

    Notice the second sequence at the bottom.

    0 讨论(0)
提交回复
热议问题