Inferring DataSet Relational Structure from XML
The relational structure, or schema, of a DataSet is made up of tables, columns, constraints, and relations. When loading a DataSet from XML, the schema can be pre-defined, or it can be created, either explicitly or through inference, from the XML being loaded. For more information about loading the schema and contents of a DataSet from XML, see Loading a DataSet from XML and Loading DataSet Schema Information from XML.
If the schema of a DataSet is being created from XML, the preferred method is to explicitly specify the schema using either the XML Schema definition language (XSD) (as described in Generating DataSet Relational Structure from XML Schema (XSD)) or the XML-Data Reduced (XDR). If no XML Schema or XDR schema is available in the XML, the schema of the DataSet can be inferred from the structure of the XML elements and attributes.
This section describes the rules for DataSet schema inference by showing XML elements and attributes and their structure, and the resulting inferred DataSet schema.
Specifying the Attributes to be Inferred
Not all attributes present in an XML document should be included in the inference process. Namespace-qualified attributes can include metadata that is important for the XML document but not for the DataSet schema. Using DataSet.InferXmlSchema, you can set specific namespaces to be ignored during the inference process. For more information, see Loading DataSet Schema Information from XML.
In This Section
- Summary of the DataSet Schema Inference Process
- Provides a high-level summary of the rules for inferring the schema of a DataSet from XML.
- Inferring Tables
- Describes the XML elements that are inferred as tables in a DataSet.
- Inferring Columns
- Describes the XML elements and attributes that are inferred as table columns.
- Inferring Relationships
- Describes the DataRelation and ForeignKeyConstraint objects created for nested, inferred tables.
- Inferring Element Text
- Describes the columns that are created for text in XML elements, and explains when text in XML elements is ignored.
- Inference Limitations
- Discusses the limitations of schema inference.
- XML and the DataSet
- Describes how the DataSet object interacts with XML data.
- Generating DataSet Relational Structure from XML Schema (XSD)
- Describes the relational structure, or schema, of a DataSet that is created from XML Schema definition language (XSD) schema.
- Accessing Data with ADO.NET
- Describes the ADO.NET architecture and components and how to use them to access existing data sources as well as to manage application data.