First the XSD schema <a target="_blank" href="/quickstart/util/srcctrlwin.aspx?path=/quickstart/howto/samples/Xml/LoadDataSetXMLData/&file=books.xsd">books.xsd</a>
is loaded into the <b>DataSet</b> property on the XmlDataDocument and the XML file
<a target="_blank" href="/quickstart/util/srcctrlwin.aspx?path=/quickstart/howto/samples/Xml/LoadDataSetXMLData/&file=books.xml">books.xml</a> is loaded with
the XmlDataDocument <b>Load</b> method. This is shown in the code below.</div>
<div class="code"><xmp>
private const String m_Document = "books.xml";
private const String m_Schema = "books.xsd";
XmlDataDocument m_datadoc = new XmlDataDocument();
ParseSchema(m_Schema);
DisplayTableStructure();
m_datadoc.Load(m_Document);
DisplayTables(m_datadoc.DataSet);
</xmp></div>
<div class="indent" style="width:660">
As in the previous topic, by simply iterating over the collections of Tables, Columns and Rows and formatting the output we can display both the internal
table structure with the DisplayTableStructure() method (built with the
and the content of the XML file with the DisplayTables() method. This time we use the foreach keyword instead of a for loop to illustrate an alternative
mechanism for iterating over the collections. See <a href="/quickstart/howto/doc/Xml/DataSetMapXSDSchema.aspx">How Do I...Create DataSet mappings from an XSD schema?</a>