As mentioned in the previous topic, the XmlDataDocument class is an in-memory cache for XML data. The DataDocumentReader provides an implementation of an XmlReader
and consumes an XmlDataDocument to provide a mechanism for reading the data directly rather than using the W3C DOM methods. However the DataDocumentReader is not yet
implemented so an alternative approach is demonstrated here to obtain an XmlReader. In this sample we are going to load the XmlDataDocument with XML data using
the sample file <a target="_blank" href="/quickstart/util/srcctrlwin.aspx?path=/quickstart/howto/samples/Xml/StreamXmlDocument/&file=books.xml">books.xml</a>
and display the loaded XML with an XmlReader. The XmlReader allows you to perform a sequential read on the XML data.
See <a href="ReadXmlFile.aspx">How do I...Read XML from a file?</a> topic. The sample code below illustrates this.</div>
which replicates all the XML from the root node. Then by creating a DataDocumentNavigator onto the XmlDataDocument we can perform a transform on all the nodes
and be returned a reader onto the transformed data. This reader can now be used to read the XML data in the XmlDataDocument.
The DataDocumentNavigator class is covered in <A target=content href="NavigateXmlDocument.aspx">How Do I...Navigate XML with the XmlNavigator?</A> and
the XslTransform class is covered in <A target=content href="TransformXml.aspx">How Do I...Apply an XSL transformation to XML?</A></div>
<H4>Summary</H4>
<OL>
<LI>An XmlReader can be obtained for the XML data in the XmlDataDocument via an XslTransform.
<LI>The DataDocumentReader class will provide an implementation of the XmlReader class to perform sequential reads on the XML data in an XmlDataDocument.
<LI>The DataDocumentReader provides and alternative, faster mechanism for reading the XML from the in-memory cache, rather than using the DOM classes and methods.