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         ("\DataSet_AutoInc_NotNull_UniqueContraint.xml")); l_AnotherDS.ReadXml(l_XmlTextReader, XmlReadMode.InferSchema); l_XmlTextReader.Close(); VB l_XmlTextReader = new System.Xml.XmlTextReader(new         System.IO.StreamReader         ("\DataSet_AutoInc_NotNull_UniqueContraint.xml")) l_AnotherDS.ReadXml(l_XmlTextReader, XmlReadMode.InferSchema) l_XmlTextReader.Close() 


Microsoft.NET Compact Framework Kick Start
Microsoft .NET Compact Framework Kick Start
ISBN: 0672325705
EAN: 2147483647
Year: 2003
Pages: 206

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net