[英]Can't get xs:element with attribute
我有带有和不带有属性的XML元素
<xs:element name='element0'>
<xs:complexType name='internationalShoeSize'>
<xs:annotation>
<xs:documentation>Data ...</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:string'>
<xs:attribute name='attribute0' type='xs:string' />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name='element1'>
<xs:complexType name='internationalShoeSize'>
<xs:annotation>
<xs:documentation>Data1 ...</xs:documentation>
</xs:annotation>
</xs:element>
当我获取数据表中的元素时,仅获取没有属性的元素。
foreach(DataColum colum in table.colums)
{
....
}
此foreach仅获取没有属性的元素: element1
。 如何获得带有或不带有属性的所有元素?
我认为您需要从一个更好的纲要开始,您发布的纲要已被滥用。 我拿走了你的东西并清理了它-在这个过程中可能偏离了你的意图; 请随意拿我的样本,并用它来编辑您的问题,以更好地说明问题。
(Alternatively, if you have a sample XML, post that instead - it might be even easier to explain.)
<?xml version="1.0" encoding="utf-8" ?>
<!-- XML Schema generated by QTAssistant/XSD Module (http://www.paschidev.com) -->
<xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd" xmlns="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="element0" type="internationalShoeSize"/>
<xs:element name="element1" type="internationalShoeSize"/>
<xs:complexType name="internationalShoeSize">
<xs:annotation>
<xs:documentation>Data ...</xs:documentation>
</xs:annotation>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="attribute0" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
同时,这是等效的数据结构(在.NET上):
您的属性在那里...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.