.NET Framework Class Library XmlReadMode Enumeration Specifies how to read XML data and a relational schema into a DataSet.
Namespace:
System.Data
Assembly:
System.Data (in System.Data.dll)

Syntax
Public Enumeration XmlReadMode
public enum class XmlReadMode

Members
| Member name | Description |
|---|
.gif) | Auto | Default. Performs the most appropriate of these actions: If the data is a DiffGram, sets XmlReadMode to DiffGram. -or- If the dataset already has a schema, or the document contains an in-line schema, sets XmlReadMode to ReadSchema. -or- If the dataset does not already have a schema and the document does not contain an in-line schema, sets XmlReadMode to InferSchema. | .gif) | ReadSchema | Reads any inline schema and loads the data. If the DataSet already contains schema, new tables may be added to the schema, but an exception is thrown if any tables in the inline schema already exist in the DataSet. | .gif) | IgnoreSchema | Ignores any inline schema and reads data into the existing DataSet schema. If any data does not match the existing schema, it is discarded (including data from differing namespaces defined for the DataSet). If the data is a DiffGram, IgnoreSchema has the same functionality as DiffGram. | .gif) | InferSchema | Ignores any inline schema, infers schema from the data and loads the data. If the DataSet already contains a schema, the current schema is extended by adding new tables or adding columns to existing tables. An exception is thrown if the inferred table already exists but with a different namespace, or if any of the inferred columns conflict with existing columns. | .gif) | DiffGram | Reads a DiffGram, applying changes from the DiffGram to the DataSet. The semantics are identical to those of a Merge operation. As with the Merge operation, RowState values are preserved. Input to ReadXml with DiffGrams should only be obtained using the output from WriteXml as a DiffGram. The target DataSet must have the same schema as the DataSet on which WriteXml as DiffGram is called. Otherwise the DiffGram merge operation fails, and an exception is thrown. | .gif) | Fragment | Reads XML fragments, such as those generated by executing FOR XML queries, against an instance of SQL Server. When XmlReadMode is set to Fragment, the default namespace is read as the inline schema. | .gif) | InferTypedSchema | Ignores any inline schema, infers a strongly typed schema from the data, and loads the data. If the type cannot be inferred from the data, it is interpreted as string data. If the DataSet already contains a schema, the current schema is extended, either by adding new tables or by adding columns to existing tables. An exception is thrown if the inferred table already exists but with a different namespace, or if any of the inferred columns conflict with existing columns. |

Remarks
Use the members of this enumeration when setting the ReadMode parameter of the ReadXml method. Note |
|---|
Auto mode may be slower than setting XmlReadMode to an explicit option. |

Version Information
.NET FrameworkSupported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0 .NET Framework Client ProfileSupported in: 4, 3.5 SP1

Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

See Also
|
Biblioteca de clases de .NET Framework XmlReadMode (Enumeración) Especifica cómo leer datos XML y un esquema relacional en un DataSet.
Espacio de nombres:
System.Data
Ensamblado:
System.Data (en System.Data.dll)

Sintaxis
Public Enumeration XmlReadMode
public enum class XmlReadMode

Miembros
| Nombre de miembro | Descripción |
|---|
.gif) | Auto | Predeterminado. Realiza la acción más apropiada de las que se muestran a continuación: Si los datos constituyen un DiffGram, establece XmlReadMode en DiffGram. O bien Si el conjunto de datos ya tiene un esquema o el documento contiene un esquema en línea, establece XmlReadMode en ReadSchema. O bien Si el conjunto de datos aún no tiene un esquema y el documento no contiene un esquema en línea, establece XmlReadMode en InferSchema. | .gif) | ReadSchema | Lee cualquier esquema en línea y carga los datos. Si el DataSet ya contiene un esquema, se pueden agregar al mismo las nuevas tablas, aunque se producirá una excepción si cualquier tabla del esquema en línea ya existe en el DataSet. | .gif) | IgnoreSchema | Omite cualquier esquema en línea y lee los datos del esquema del DataSet existente. Si los datos no coinciden con el esquema existente, se descartan (incluidos los datos de espacios de nombres distintos definidos para el DataSet). Si los datos constituyen un DiffGram, IgnoreSchema tiene la misma funcionalidad que DiffGram. | .gif) | InferSchema | Omite cualquier esquema en línea, deduce el esquema a partir de los datos y los carga. Si el DataSet ya contiene un esquema, se extiende el esquema actual mediante la adición de nuevas tablas o la adición de columnas a las tablas existentes. Se producirá una excepción si la tabla deducida ya existe con un espacio de nombres distinto, o si cualquiera de las columnas deducidas entra en conflicto con las columnas existentes. | .gif) | DiffGram | Lee un DiffGram, aplicando los cambios del DiffGram a DataSet. La semántica es idéntica a la de una operación Merge. Al igual que ocurre con la operación Merge, se conservan los valores RowState. La entrada a ReadXml mediante DiffGrams sólo se puede obtener si se utiliza la salida de WriteXml como un DiffGram. El DataSet de destino debe tener el mismo esquema que el DataSet en el que se llama a WriteXml como DiffGram. De lo contrario, se producirá un error en la operación de combinación de DiffGram y se producirá una excepción. | .gif) | Fragment | Lee fragmentos XML, como los que se generan al ejecutar consultas FOR XML, en una instancia de SQL Server. Al establecer XmlReadMode en Fragment, se lee el espacio de nombres predeterminado como el esquema en línea. | .gif) | InferTypedSchema | Omite cualquier esquema en línea, deduce el esquema con establecimiento inflexible de tipos a partir de los datos y los carga. Si el tipo no se puede deducir de los datos, se interpreta como datos de cadena. Si el DataSet ya contiene un esquema, se extiende el esquema actual mediante la adición de nuevas tablas o columnas a las tablas existentes. Se producirá una excepción si la tabla deducida ya existe con un espacio de nombres distinto, o si cualquiera de las columnas deducidas entra en conflicto con las columnas existentes. |

Comentarios
Utilice los miembros de esta enumeración al establecer el parámetro ReadMode del método ReadXml. Nota |
|---|
El modo Auto puede resultar más lento que establecer XmlReadMode en una opción explícita. |

Información de versión
.NET FrameworkCompatible con: 4, 3.5, 3.0, 2.0, 1.1, 1.0 .NET Framework Client ProfileCompatible con: 4, 3.5 SP1

Plataformas
Windows 7, Windows Vista SP1 o posterior, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (no se admite Server Core), Windows Server 2008 R2 (se admite Server Core con SP1 o posterior), Windows Server 2003 SP2
.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Vea también
|