Inferring Schema

In some circumstances you may want to load XML data into an empty DataSet while ignoring the schema information in the XML. In this case, the DataSet is able to infer the schema by looking at the tables in the XML data. The DataSet creates its own schema to match that of the tables loaded, but there is no way to infer such things as autoincremented fields, constraints, and so on.

If the XML data loaded into an empty DataSet has no schema information, then the schema is inferred automatically. To explicitly ask that the schema be inferred, call DataSet.ReadXml(XmlReader, XmlReadMode). Pass XmlReadMode.InferSchema as an argument. See these snippets, for example:

 C# l_XmlTextReader = new System.Xml.XmlTextReader(new System.IO.StreamReader ...

Get Microsoft® .NET Compact Framework Kick Start now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.