I want to populate 2 tables from 2 xml files one for states and one for countries that look like this:
<?xml version="1.0" encoding="utf-8" ?>
I try to create a table from it with this in the constructor of a provider ob:
postalCodes = new DataSet("PostalCodes");
XmlTextReader sStreamer = new XmlTextReader(statesPath);
XmlTextReader cStreamer = new XmlTextReader(countriesPat
DataTable states = new DataTable("States");
DataTable countries = new DataTable("Countries");
states.Locale = System.Globalization.Cultu
countries.Locale = System.Globalization.Cultu
But I get an error...
eption : DataTable does not support schema inference from Xml.
MSDN suggests using an overloaded method that supports XMLReadMode but this functionality is apparently hidden.
From MSDN: http://msdn2.microsoft.com/en-us/library/z447ey0x.aspx
"The ReadXml method provides a way to read either data only, or both data and schema into a DataTable from an XML document, whereas the ReadXmlSchema method reads only the schema. To read both data and schema, use one of the ReadXML overloads that includes the XmlReadMode parameter, and set its value to ReadSchema."
I also noticed this (same article):
"If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised."
Question: How do you get it to infer the structure?
Sub Question: Is there a better way to approach loading these tables in the dataset?