DataSet.WriteXmlSchema Method

Definition

Writes the DataSet structure as an XML schema.

Overloads

WriteXmlSchema(String, Converter<Type,String>)

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

WriteXmlSchema(Stream)

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

WriteXmlSchema(TextWriter)

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

WriteXmlSchema(String)

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

WriteXmlSchema(XmlWriter)

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

WriteXmlSchema(Stream, Converter<Type,String>)

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

WriteXmlSchema(TextWriter, Converter<Type,String>)

Writes the DataSet structure as an XML schema to the specified TextWriter.

WriteXmlSchema(XmlWriter, Converter<Type,String>)

Writes the DataSet structure as an XML schema to the specified XmlWriter.

WriteXmlSchema(String, Converter<Type,String>)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

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

C#
public void WriteXmlSchema(string fileName, Converter<Type,string> multipleTargetConverter);

Parameters

fileName
String

The name of the file to write to.

multipleTargetConverter
Converter<Type,String>

A delegate used to convert Type to string.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

WriteXmlSchema(Stream)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

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

C#
public void WriteXmlSchema(System.IO.Stream? stream);
C#
public void WriteXmlSchema(System.IO.Stream stream);

Parameters

stream
Stream

A Stream object used to write to a file.

Examples

The following example creates a new FileStream object that is passed to the WriteXmlSchema method to write the schema to disk.

C#
private void WriteSchemaWithFileStream(DataSet thisDataSet)
{
    // Set the file path and name. Modify this for your purposes.
    string filename="Schema.xml";

    // Create the FileStream object with the file name.
    // Use FileMode.Create.
    System.IO.FileStream stream =
        new System.IO.FileStream(filename,System.IO.FileMode.Create);

    // Write the schema to the file.
    thisDataSet.WriteXmlSchema(stream);

    // Close the FileStream.
    stream.Close();
}

Remarks

Use the WriteXmlSchema method to write the schema for a DataSet to an XML document. 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.

To write the data to an XML document, use the WriteXml method.

Classes that derive from the Stream class include BufferedStream, FileStream, MemoryStream, and NetworkStream.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

WriteXmlSchema(TextWriter)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

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

C#
public void WriteXmlSchema(System.IO.TextWriter? writer);
C#
public void WriteXmlSchema(System.IO.TextWriter writer);

Parameters

writer
TextWriter

The TextWriter object with which to write.

Examples

The following example creates a System.Text.StringBuilder object to that is used to create a new System.IO.StringWriter. The StringWriter is passed to the WriteXmlSchema method, and the resulting string is printed to the console window.

C#
private void WriteSchemaWithStringWriter(DataSet thisDataSet)
{
    // Create a new StringBuilder object.
    System.Text.StringBuilder builder = new System.Text.StringBuilder();

    // Create the StringWriter object with the StringBuilder object.
    System.IO.StringWriter writer = new System.IO.StringWriter(builder);

    // Write the schema into the StringWriter.
    thisDataSet.WriteXmlSchema(writer);

    // Print the string to the console window.
    Console.WriteLine(writer.ToString());
}

Remarks

Use the WriteXmlSchema method to write the schema for a DataSet to an XML document. 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.

To write the data to an XML document, use the WriteXml method.

Classes the derive from the System.IO.TextWriter class include the System.Web.HttpWriter, System.CodeDom.Compiler.IndentedTextWriter, System.Web.UI.HtmlTextWriter, System.IO.StreamWriter, and System.IO.StringWriter.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

WriteXmlSchema(String)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

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

C#
public void WriteXmlSchema(string fileName);

Parameters

fileName
String

The file name (including the path) to which to write.

Exceptions

Examples

C#
private void WriteSchemaToFile(DataSet thisDataSet)
{
    // Set the file path and name. Modify this for your purposes.
    string filename="Schema.xml";

    // Write the schema to the file.
    thisDataSet.WriteXmlSchema(filename);
}

Remarks

Use the WriteXmlSchema method to write the schema for a DataSet to an XML document. 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.

To write the data to an XML document, use the WriteXml method.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

WriteXmlSchema(XmlWriter)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

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

C#
public void WriteXmlSchema(System.Xml.XmlWriter? writer);
C#
public void WriteXmlSchema(System.Xml.XmlWriter writer);

Parameters

writer
XmlWriter

The XmlWriter to write to.

Examples

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

C#
private void WriteSchemaWithXmlTextWriter(DataSet thisDataSet)
{
    // Set the file path and name. Modify this for your purposes.
    string filename="SchemaDoc.xml";

    // Create a FileStream object with the file path and name.
    System.IO.FileStream stream = new System.IO.FileStream
        (filename,System.IO.FileMode.Create);

    // Create a new XmlTextWriter object with the FileStream.
    System.Xml.XmlTextWriter writer =
        new System.Xml.XmlTextWriter(stream,
        System.Text.Encoding.Unicode);

    // Write the schema into the DataSet and close the reader.
    thisDataSet.WriteXmlSchema(writer );
    writer.Close();
}

Remarks

Use the WriteXmlSchema method to write the schema for a DataSet to an XML document. 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.

To write the data to an XML document, use the WriteXml method.

One class that inherits from the System.Xml.XmlWriter class is the XmlTextWriter class.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

WriteXmlSchema(Stream, Converter<Type,String>)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

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

C#
public void WriteXmlSchema(System.IO.Stream? stream, Converter<Type,string> multipleTargetConverter);
C#
public void WriteXmlSchema(System.IO.Stream stream, Converter<Type,string> multipleTargetConverter);

Parameters

stream
Stream

A Stream object to write to.

multipleTargetConverter
Converter<Type,String>

A delegate used to convert Type to string.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

WriteXmlSchema(TextWriter, Converter<Type,String>)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

Writes the DataSet structure as an XML schema to the specified TextWriter.

C#
public void WriteXmlSchema(System.IO.TextWriter? writer, Converter<Type,string> multipleTargetConverter);
C#
public void WriteXmlSchema(System.IO.TextWriter writer, Converter<Type,string> multipleTargetConverter);

Parameters

writer
TextWriter

A TextWriter object to write to.

multipleTargetConverter
Converter<Type,String>

A delegate used to convert Type to string.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

WriteXmlSchema(XmlWriter, Converter<Type,String>)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

Writes the DataSet structure as an XML schema to the specified XmlWriter.

C#
public void WriteXmlSchema(System.Xml.XmlWriter? writer, Converter<Type,string> multipleTargetConverter);
C#
public void WriteXmlSchema(System.Xml.XmlWriter writer, Converter<Type,string> multipleTargetConverter);

Parameters

writer
XmlWriter

A XmlWriter object to write to.

multipleTargetConverter
Converter<Type,String>

A delegate used to convert Type to string.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1