asp.net.ph

DataSet.WriteXmlSchema Method

System.Data Namespace   DataSet Class


Writes the DataSet structure as an XML schema.

Overload List

1. Writes the DataSet structure as an XML schema using the specified Stream object.

2. Writes the DataSet structure as an XML schema to a file.

3. Writes the DataSet structure as an XML schema to a TextWriter object.

4. Writes the DataSet structure as an XML schema to an XmlWriter object.


Example

The following example initializes a new System.IO.FileStream object with the specified path, which is used to create an XmlTextWriter object. The WriteXmlSchema method is then invoked with the XmlTextWriter object to write the schema to the disk.

NOTE: This example uses one of the overloaded versions of WriteXmlSchema. For other examples that may be available, see the individual overload topics.

private void WriteSchemaWithXmlTextWriter ( DataSet thisDataSet ) {
   // 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.Create );
   // create a new XmlTextWriter object with the FileStream.
   System.Xml.XmlTextWriter myXmlTextWriter  = 
      new System.Xml.XmlTextWriter ( myFileStream,
         System.Text.Encoding.Unicode );
   // write the schema into the DataSet and close the writer.
   thisDataSet.WriteXmlSchema ( myXmlTextWriter );
   myXmlTextWriter.Close ( );
}
  C# VB

See Also

DataSet Members   ReadXml   ReadXmlSchema   WriteXml 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