O'Reilly logo

Microsoft® .NET Compact Framework Kick Start by Ronnie Yates, Erik Rubin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required