Inference Limitations

The process of inferring a DataSet schema from XML is not deterministic, in that different instances of XML documents having the same intended schema can result in different schemas depending on the XML elements in each document. For example, consider the following XML documents:

Document1:

<DocumentElement>
  <Element1>Text1</Element1>
  <Element1>Text2</Element1>
</DocumentElement>

Document2:

<DocumentElement>
  <Element1>Text1</Element1>
</DocumentElement>

For "Document1", the inference process will produce a DataSet named "DocumentElement" and a table named "Element1", because "Element1" is a repeating element.

DataSet: DocumentElement

Table: Element1

Element1_Text
Text1
Text2

However, for "Document2", the inference process will produce a DataSet named "NewDataSet" and a table named "DocumentElement". "Element1" will be inferred as a column because it has no attributes and no child elements.

DataSet: NewDataSet

Table: DocumentElement

Element1
Text1

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, it is recommended 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 Generating DataSet Relational Structure from XML Schema (XSD).

See Also

Inferring DataSet Relational Structure from XML | Loading a DataSet from XML | Loading DataSet Schema Information from XML | XML and the DataSet | Creating and Using DataSets