DataSet 載入XML 資料效果

來源:互聯網
上載者:User

.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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.