DataSet 加载XML 数据效果
.NET 能将 XML 架构和数据读入 DataSet
对于如下的XML
<?xml version="1.0" encoding="utf-8" ?>
<dsPubs>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="dsPubs">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="authors">
<xs:complexType>
<xs:sequence>
<xs:element name="au_id" type="xs:string" />
<xs:element name="au_lname" type="xs:string" />
<xs:element name="au_fname" type="xs:string" />
<xs:element name="au_phone" type="xs:string" />
<xs:element name="orders">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="order" type="xs:unsignedByte" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<authors>
<au_id>172-32-1176</au_id>
<au_lname>国国</au_lname>
<au_fname>Paul</au_fname>
<au_phone>408 555-0123</au_phone>
<orders>
<order>1</order>
<order>2</order>
<order>3</order>
</orders>
</authors>
<authors>
<au_id>213-46-8915</au_id>
<au_lname>Gray</au_lname>
<au_fname>Chris</au_fname>
<au_phone>415 555-0120</au_phone>
<orders>
<order>11</order>
<order>22</order>
<order>33</order>
</orders>
</authors>
<authors>
<au_id>id</au_id>
<au_lname>lname</au_lname>
<au_fname>fname</au_fname>
<au_phone>phone</au_phone>
<orders>
<order>111 </order>
<order>222 </order>
</orders>
</authors>
</dsPubs>
加载为DATASET后则是如下表格效果
| au_id | au_lname | au_fname | au_phone | authors_Id |
|---|---|---|---|---|
| 172-32-1176 | 国国 | Paul | 408 555-0123 | 0 |
| 213-46-8915 | Gray | Chris | 415 555-0120 | 1 |
| id | lname | fname | phone | 2 |
| orders_Id | authors_Id |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 2 |
| order_Column | orders_Id |
|---|---|
| 1 | 0 |
| 2 | 0 |
| 3 | 0 |
| 11 | 1 |
| 22 | 1 |
| 33 | 1 |
| 111 | 2 |
| 222 | 2 |
浙公网安备 33010602011771号