The process of inferring a DataSet schema from XML can result in different schemas depending on the XML elements in each document. For example, consider the following XML documents.
<DocumentElement> <Element1>Text1</Element1> <Element1>Text2</Element1> </DocumentElement>
<DocumentElement> <Element1>Text1</Element1> </DocumentElement>
For "Document1," the inference process produces a DataSet named "DocumentElement" and a table named "Element1," because "Element1" is a repeating element.
However, for "Document2," the inference process produces a DataSet named "NewDataSet" and a table named "DocumentElement." "Element1" is inferred as a column because it has no attributes and no child elements.
These two XML documents may have been intended to produce the same schema, but the inference process produces very different results based on the elements contained in each document.
To avoid the discrepancies that can occur when generating schema from an XML document, we recommend that you explicitly specify a schema using XML Schema definition language (XSD) or XML-Data Reduced (XDR) when loading a DataSet from XML. For more information about explicitly specifying a DataSet schema with XML Schema, see Deriving DataSet Relational Structure from XML Schema (XSD).
Inferring DataSet Relational Structure from XML
Loading a DataSet from XML
Loading DataSet Schema Information from XML
Using XML in a DataSet
DataSets, DataTables, and DataViews
ADO.NET Managed Providers and DataSet Developer Center