C# 同一表格';名称';不能是两个嵌套关系中的子表
在这里和那里已经问过好几次了,一些答案与旧的VS版本有关(这篇文章使用的是V.S.2012) 我再次提出这个问题: 给定xsd:C# 同一表格';名称';不能是两个嵌套关系中的子表,c#,xml,xsd,C#,Xml,Xsd,在这里和那里已经问过好几次了,一些答案与旧的VS版本有关(这篇文章使用的是V.S.2012) 我再次提出这个问题: 给定xsd: <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="LocationType"> <xs:attribute name="X" type="xs:i
<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>
注意-字母数字有一个位置元素,位图和圆弧都有字母数字元素
当我创建一个cs类(使用XSD工具)并尝试实例化它时,我得到以下错误:
同一个表“AlphaNumericLocation”不能是两个表中的子表
嵌套关系
我如何克服这个问题?
(真正的xsd更复杂,并且有更多“相关的相似”子项
我想在类型化数据集中使用我的应用程序中的xml数据(可以轻松读取和解析xml)。
而且我可以轻松地将表和列绑定到其他控件…(网格)Microsoft的XML解析器不支持这一点:我认为自VS的早期版本以来,它没有改变
在这里查看一些关于如何做的提示:微软的XML解析器不支持这一点:我认为它自VS的早期版本以来没有改变
在这里查看一些关于如何做的提示:我已经发布了一个解决此问题的方法。 显然,这可能不是每个人的解决方案, 但至少它解释了问题的根源,指出了有问题的代码 此外,您应该在模式中使用“嵌套”,这将解决问题 我无法调整您的模式,因此您必须自己尝试,但我已经调整了自己的模式。这是一个包含两个表的数据集,其中MyRootTable与“PremiumPerYear”具有嵌套关系
这个嵌套关系中的关键角色是
,我已经发布了一个解决这个问题的方法。
显然,这可能不是每个人的解决方案,
但至少它解释了问题的根源,指出了有问题的代码
此外,您应该在模式中使用“嵌套”,这将解决问题
我无法调整您的模式,因此您必须自己尝试,但我已经调整了自己的模式。这是一个包含两个表的数据集,其中MyRootTable与“PremiumPerYear”具有嵌套关系
这个嵌套关系中的关键角色是xml可以使用它。数据集版本是问题。我可以在设计器中看到xsd。我不能使用它…xml可以使用它。数据集版本是问题。我可以在设计器中看到xsd。我不能使用它。。。