How to export dataset ing from XML
This example illustrates how to create a dataset (Dataset) ing from XML data. In this example, the concept of reasoning can be used to make the actual structure of XML data the basis of the relational architecture. In this example, the relational structure of tables and columns is created to store data in a dataset that complies with the export architecture.
|
VB datasetmapxmldata. aspx |
[Running example] | [View Source code] |
To export the architecture from the XML data structure, the following exampleCodeDescribes how to use the inferschema of xmlreadmode to call dataset. readxml. If you do not specify an xmlreadmode, The readxml method derives an architecture when the dataset has no schema and the document does not include an inline schema.
// Infer the dataset schema from the XML data and load the XML data datadoc. dataset. readxml (New streamreader ("books. xml"), xmlreadmode. inferschema ); 'Infer the dataset schema from the XML data and load the XML data datadoc. dataset. readxml (New streamreader ("books. xml"), xmlreadmode. inferschema) |
C # |
VB |
|
This example uses the displaytables method to display the structure and content of a dataset, just like how to load a dataset using XML. The following output shows the table name, column name, and row content generated when the displaytables method uses the schema exported from the books. xml file.
Creating an xmldatadocument... content of tables... tablename = book --------- columns... title book_id price genre publicationdate isbnnumber of rows = 3 rows... the Autobiography of Benjamin Franklin 0 8.99 autobiography 1981 1-861003-11-0the Confidence Man 1 11.99 novel 1967 0-201-63361-2the gorgias 2 9.99 philosophy 1991 1-861001-57-6tablename = Hor ------- columns... first-name last-name book_idnumber of rows = 3 rows... benjamin Franklin 0 Herman Melville 1 Sidas Plato 2
Summary
- reasoning is a mechanism through which the structure of XML data becomes the basis of the relational architecture.
- the readxml method of the dataset uses the XML file provided in streamreader to generate a link ing.