あちこちで何度か尋ねられましたが、いくつかの回答は古い VS バージョンに関連しています (これは VS 2012 を使用しています)。
私は再び問題を提示します:
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>
注意 - AlphaNumeric には位置要素があり、ビットマップとアークの両方に AlphaNumeric があります。
(XSD ツールを使用して) cs クラスを作成し、それをインスタンス化しようとすると、次のエラーが発生します。
同じテーブル 'AlphaNumericLocation' は、2 つのネストされたリレーションの子テーブルになることはできません。
この問題を解決するにはどうすればよいですか? (実際の xsd はもっと複雑で、「関連する類似」の子がもっとたくさんあります.....
型指定されたデータセット (xml を簡単に読み取って解析できる) で、アプリの xml データを使用したいと考えています。テーブルと列を他のコントロールに簡単にバインドできます...(グリッド)