Xmldatadocument -- load and use xmldatadocument

Source: Internet
Author: User
How to load XML data to xmldatadocument

This example illustrates how to load XML into the xmldatadocument class. This class extends the xmldocument class and allows you to store, retrieve, and operate structured data through the dataset class (which provides a link view on the loaded XML data. The dependency between the xmldocument class and the dataset class allows the component to mix the XML and the data source's relational views unrelated to the same basic data. As detailed in other topics, there are differences between these views. It is worth noting that you cannot access XML data not mapped to the relational view through relational objects (such as tables and rows. However, you can easily move from a link row to the corresponding XML element to access the XML data.

You can use xmldatadocument anywhere where xmldocument is used; all topics that describe xmldocument can also be applied to xmldatadocument. Therefore, the information contained in the following topics is also related to xmldatadocument:

    • How to load and use xmldocument
    • How to Use xmldocument to save XML

There is also a corresponding topic on how to read XML data from xmldatadocument. This topic mainly describes how to read XML only using xmldatadocument.

In addition, the topic uses the XML and dataset classes to provide additional information about how to use xmldatadocument and dataset.

 

VB loadxmldocument. aspx

[Running example] | [View Source code]

See the followingCodeAs shown in, this example only loads the XML data in the example file books. XML to xmldatadocument and displays the data on the screen.


 public class loadxmldocumentsample {private const string document = "books. XML "; public static void main () {loadxmldocumentsample myloadxmldocumentsample = new loadxmldocumentsample (); myloadxmldocumentsample. run (document);} public void run (string ARGs) {try {// load the XML from file console. writeline (); console. writeline ("loading file {0 }... ", argS); xmldatadocument myxmldocument = new xmldatadocument (); myxmldocument. load (ARGs); console. writeline ("xmldatadocument loaded with XML data successfully... ");} catch (exception e) {console. writeline ("exception: {0}", E. tostring () ;}}
 public class loadxmldocumentsample private const document as string = "books. XML "public shared sub main () dim myloadxmldocumentsample as loadxmldocumentsample myloadxmldocumentsample = new loadxmldocumentsample () myloadxmldocumentsample. run (document) end sub public sub run (ARGs as string) Try 'Load the XML from file console. writeline () console. writeline ("loading file {0 }... ", argS) dim myxmldocument as xmldatadocument = new xmldatadocument () myxmldocument. load (ARGs) console. writeline ("xmldatadocument loaded with XML data successfully... ") catch e as exception console. writeline ("exception: {0}", E. tostring () end try end sub end class 
C # VB  
Summary
    1. The xmldatadocument class provides memory cache for XML data.
    2. Xmldatadocument extends the xmldocument class. Xmldatadocument can be used anywhere in the xmldocument class.
    3. Xmldatadocument and dataset classes are closely related. In fact, xmldatadocument can be considered as an xmldocument for dataset recognition.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.