These topics provide an introduction to the interaction between the DataSet and XMLDataDocument objects.</div>
<h4>XML and Relational Data. Same Data, Two Views.</h4>
<div class="indent" style="width:660">
XML often has a relational structure (the fictional books in a bookstore for example) as well as being unstructured.
This set of topics cover the concept of storing
this data centrally and providing different views on this data, either as XML or relationally as tables, columns and rows with relationships. This disconnected
store of data which, for example, could represent a business object in the middle tier enforcing business rules, could serve
its data up as XML to a browser via an XSL
transform, across the internet to another site, or to a local application via the relational tables. However the data gets amended in the store, it can then be updated
to a database transactionally. Also see <A target=content href="/quickstart/howto/doc/adoplus/adoplusoverview.aspx">How do I...Get an Overview of ADO+?</A></div>
The <b>XmlDataDocument</b> provides XML APIs for accessing this in-memory cache of data as well as supporting reading and writing XML. The XmlDataDocument is a DataSet
aware object. When creating an XmlDataDocument it implicitly creates a DataSet (accessed as a property)
that provides a relational view onto the data XML data.
This symbiotic relationship between the two objects provides a powerful technique for accessing data either relationally or as XML, irrespective of the mechanism
by which the data was sourced.</div>
<h4>XmlDataDocument and DataSet Differences</h4>
<div class="indent" style="width:660">
There are differences between these objects and their views. XML loaded via the <b>Load</b> method on the XmlDataDocument maintains full fidelity, which
means that all the XML structure is maintained and can be accessed via the XML API. The <b>ReadXml</b> method on the DataSet however only
loads the XML that conforms to the internally created mappings (schema). Whitespace and element ordering, as well as data that does not conform to the relational
mapping is lost. Hence it does not retain XML fidelity. Also data which has been loaded via the XmlDataDocument and which does not conform to the internal
mappings on the DataSet cannot be viewed via the relational API. Relational loaded data can always be viewed via the XML API.</div>
XML Data can be saved from both the DataSet with the <b>WriteXmlData</b> method and the XmlDataDocument with the <b>Save</b> method. The former saves a
normalized view of the relationally mapped data (i.e. The XML data that conforms to the internal
schema, with elements ordered according to the relational schema), whilst the latter saves the XML with full
fidelity (i.e. all the XML that has been loaded into the XmlDataDocument, including the preservation of whitespace and element ordering</span>).</div>
<h4>Topics</h4>
<div class="indent" style="width:660">
Here we are going to work with XML data, DataSets and the XmlDataDocument to show this inter-change.</div>
<OL>
<LI class="indent"> Firstly we are going to cover how a DataSet can build a relational view according to
a supplied XSD schema in <A target=content href="DataSetMapXSDSchema.aspx">How do I...Create DataSet mappings from an XSD schema?</A>
<br clear="left"><br>
<LI>Then we cover how XML data gets loaded into the DataSet and accessed as relational data in
<A target=content href="LoadDataSetXMLData.aspx">How do I...Load a DataSet with XML?</A>
<br clear="left"><br>
<LI>Next we cover how to infer a relational mapping from XML data, rather than an XSD schema in
<A target=content href="DataSetMapXMLData.aspx">How do I...Infer DataSet mappings from XML?</A><br clear="left"><br>
<LI>Then we show how to save the infered schema generated from loaded XML data in
<A target=content href="SaveDataSetMapXSDSchema.aspx">How do I...Save DataSet mappings to an XSD schema file?</A>
<br clear="left"><br>
<LI>And finally we cover how to access and save XML that has been loaded into the DataSet relationally in
<A target=content href="SaveDataSetXML.aspx">How do I...Save a DataSet as XML?</A> </LI>
<br clear="left"><br>
</OL>
<h4>Related Topics</h4>
<div class="indent" style="width:660">
Many features of the XmlDataDocument object utilizing the XML API have already been covered in the following preceding topics and these should be referred to in
those scenarios whereby data is assessed as XML.
</div>
<OL>
<LI class="indent"><A target=content href="LoadXmlDocument.aspx">How do I...Load and use the XmlDataDocument?</A>
<br clear="left"><br>
<LI><A target=content href="StreamAnXmlDocument.aspx">How do I...Read XML from an XmlDataDocument?</A>
<br clear="left"><br>
<LI><A target=content href="NavigateXmlDocument.aspx">How do I...Navigate XML with the XmlNavigator?</A>
<br clear="left"><br>
<LI><A target=content href="EditingXmlDocument.aspx">How do I...Edit XML with the XmlNavigator?</A> </LI>
<br clear="left"><br>
</OL>
<div class="indent" style="width:660">
For coverage of the interaction between the DataSet and databases using managed providers see
<A target=content href="/quickstart/howto/doc/adoplus/adoplusoverview.aspx">How do I...Get an Overview of ADO+?</A>