asp.net.ph

DataSet.ReadXmlSchema Method ( XmlReader )

System.Data Namespace   DataSet Class


Reads the XML schema from the specified XmlReader into the DataSet.

[ VB ]
Overloads Public Function ReadXmlSchema ( _
   ByVal reader As XmlReader _
)

[ C# ]
public void ReadXmlSchema (
   XmlReader reader
);

[ C++ ]
public: void ReadXmlSchema (
   XmlReader* reader
);

[ JScript ]
public function ReadXmlSchema (
   reader : XmlReader
);

Parameters

reader
The XmlReader from which to read.

Remarks

Use the ReadXmlSchema method to create the schema for a DataSet. The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the WriteXmlSchema method.

The XML schema is written using the XSD standard.

The ReadXmlSchema method is generally invoked before invoking the ReadXml method which is used to fill the DataSet.

The System.Xml.XmlReader class is abstract. A class that inherits from the XmlReader is the XmlTextReader class.

Example

The following shows an example of using this version of ReadXmlSchema.

private void ReadSchemaFromXmlTextReader ( ) {
   // create the DataSet to read the schema into.
   DataSet thisDataSet = new DataSet ( );
   // set the file path and name. Modify this for your purposes.
   string filename = "mySchema.xml";
   // create a FileStream object with the file path and name.
   System.IO.FileStream myFileStream = new System.IO.FileStream
      ( filename,System.IO.FileMode.Open );
   // create a new XmlTextReader object with the FileStream.
   System.Xml.XmlTextReader myXmlTextReader = 
      new System.Xml.XmlTextReader ( myFileStream );
   // Read the schema into the DataSet and close the reader.
   thisDataSet.ReadXmlSchema ( myXmlTextReader );
   myXmlTextReader.Close ( );
}
  C# VB

See Also

DataSet Members   DataSet.ReadXmlSchema Overload List   ReadXml   WriteXml   WriteXmlSchema Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph