Name

XmlReadMode

Synopsis

This enumeration is used to specify how a serialized DataSet file is interpreted using the DataSet.ReadXml( ) method. Generally, Auto is the most convenient option. It uses DiffGram if the file is in a DiffGram format (with versioning information), ReadSchema if the file includes an inline XSD schema, or InferSchema if the file contains only data. In addition, you can specify Fragment read mode to read an XML document such as the kind created with a FOR XML query in SQL Server 2000.

Different read modes imply different schema rules. For example, if you use DiffGram mode to try to read a serialized file into a DataSet that doesn’t match the original schema, an exception is thrown. However, you can use InferSchema on a DataSet that already has a schema, provided there are no conflicting tables and columns. The existing schema is simply extended. ReadSchema is a little more restrictive; it throws an exception if it finds any duplicate tables in the DataSet schema, even if it is compatible with the serialized file. Otherwise, it extends the existing schema with new tables. Finally, IgnoreSchema ignores any inline schemas and discards data that doesn’t match the existing schema. IgnoreSchema doesn’t work with the DiffGram format; instead, the DiffGram behavior applies.

public enum XmlReadMode {

   Auto = 0,

   ReadSchema = 1,

   IgnoreSchema = 2,

   InferSchema = 3,

   DiffGram = 4,

   Fragment = 5

}

Hierarchy

System.Object System.ValueType System.Enum(System.IComparable, System.IFormattable ...

Get ADO.NET in a Nutshell 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.