ReadXml Method

DataTable.ReadXml Method

 

Reads XML schema and data into the DataTable.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

NameDescription
System_CAPS_pubmethodReadXml(Stream)

Reads XML schema and data into the DataTable using the specified Stream.

System_CAPS_pubmethodReadXml(String)

Reads XML schema and data into the DataTable from the specified file.

System_CAPS_pubmethodReadXml(TextReader)

Reads XML schema and data into the DataTable using the specified TextReader.

System_CAPS_pubmethodReadXml(XmlReader)

Reads XML Schema and Data into the DataTable using the specified XmlReader.

The ReadXml method provides a way to read either data only, or both data and schema into a DataTable from an XML document, whereas the ReadXmlSchema method reads only the schema. To read both data and schema, use one of the ReadXML overloads that include the XmlReadMode parameter, and set its value to ReadSchema.

Note that the same is true for the WriteXml and WriteXmlSchema methods, respectively. To write XML data, or both schema and data from the DataTable, use the WriteXml method. To write just the schema, use the WriteXmlSchema method.

System_CAPS_noteNote

An InvalidOperationException will be thrown if a column type in the DataRow being read from or written to implements IDynamicMetaObjectProvider and does not implement IXmlSerializable.

Return to top
Show:
© 2016 Microsoft