The same table name cannot be a child table in two nested relationships

Several times given here and here, some answers relate to older versions of VS (this has been used since VS 2012).

I submit the problem again:

considering xsd:

<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:complexType name="LocationType">
        <xs:attribute name="X" type="xs:integer" />
        <xs:attribute name="Y" type="xs:integer" />
    </xs:complexType>

    <xs:complexType name="AlphaNumericType">
        <xs:sequence>
            <xs:element name="AlphaNumericLocation" type="LocationType" />
        </xs:sequence>
        <xs:attribute name="id" type="xs:string" />
        <xs:attribute name="key" type="xs:integer" />
    </xs:complexType>

 <xs:complexType name="BitmapType">
            <xs:sequence>
                <xs:element name="BitmapLocation" type="LocationType" />
                <xs:element name="BitmapCaptions" type="AlphaNumericType" />
            </xs:sequence>
            <xs:attribute name="key" type="xs:string" />
            <xs:attribute name="id" type="xs:string" />
        </xs:complexType>

    <xs:complexType name="ArcType">
            <xs:sequence>
                <xs:element name="ArcLocation" type="LocationType" />
                <xs:element name="ArcCaptions" type="AlphaNumericType" />
            </xs:sequence>
            <xs:attribute name="key" type="xs:string" />
            <xs:attribute name="id" type="xs:string" />
        </xs:complexType>


    <xs:element name="BitmapControls">
        <xs:complexType>
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:element name="Bitmap" type="BitmapType" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="ArcControls">
        <xs:complexType>
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:element name="Arc" type="ArcType" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

Note that AlphaNumeric has a location element, and both bitmaps and arcs have AlphaNumeric.

When I create the cs class (using the XSD tool) and try to create it, I get this error:

The same "AlphaNumericLocation" table cannot be a child table in two nested relationships.

How can I solve this problem? (real xsd is more complex and has many more "similar similar" children .....

xml ( xml). ... ()

0
2

. , , , , , .

WriteXML

, "" , .

, , . DataSet , MyRootTable "PremiumPerYear".

<xs:choice element. ( ) . / 'ref': <xs:element ref="PremiumPerYear" />

: " ", , 90 .   <DataSet> <xs:schema id="NewDataSet" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop"> <xs:element name="PremiumPerYear"> <xs:complexType> <xs:sequence> <xs:element name="BeforeTaxes" type="xs:decimal" minOccurs="0" /> <xs:element name="AfterTaxes" type="xs:decimal" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="PremiumPerYear" /> <xs:element name="MyRootTable"> <xs:complexType> <xs:sequence> <xs:element name="RequestType" msprop:KeyValueCategory="KindOfRequest" type="xs:string" minOccurs="0" /> <xs:element name="RequestDateTime" type="xs:dateTime" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema> </DataSet>

+1

All Articles