Editare

Partajați prin


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.

public:
 void WriteXmlSchema(System::String ^ fileName, Converter<Type ^, System::String ^> ^ multipleTargetConverter);
public void WriteXmlSchema (string fileName, Converter<Type,string> multipleTargetConverter);
member this.WriteXmlSchema : string * Converter<Type, string> -> unit
Public Sub WriteXmlSchema (fileName As String, multipleTargetConverter As Converter(Of Type, String))

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

WriteXmlSchema(Stream)

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

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

public:
 void WriteXmlSchema(System::IO::Stream ^ stream);
public void WriteXmlSchema (System.IO.Stream? stream);
public void WriteXmlSchema (System.IO.Stream stream);
member this.WriteXmlSchema : System.IO.Stream -> unit
Public Sub WriteXmlSchema (stream As 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.

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();
}
Private Sub WriteSchemaWithFileStream(thisDataSet As DataSet)
    ' Set the file path and name. Modify this for your purposes.
    Dim filename As String = "Schema.xml"

    ' Create the FileStream object with the file name. 
    ' Use FileMode.Create.
    Dim stream As New System.IO.FileStream _
        (filename, System.IO.FileMode.Create)

    ' Write the schema to the file.
    thisDataSet.WriteXmlSchema(stream)

    ' Close the FileStream.
    stream.Close()
End Sub

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

WriteXmlSchema(TextWriter)

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

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

public:
 void WriteXmlSchema(System::IO::TextWriter ^ writer);
public void WriteXmlSchema (System.IO.TextWriter? writer);
public void WriteXmlSchema (System.IO.TextWriter writer);
member this.WriteXmlSchema : System.IO.TextWriter -> unit
Public Sub WriteXmlSchema (writer As TextWriter)

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.

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());
}
Private Sub WriteSchemaWithStringWriter(thisDataSet As DataSet)
    ' Create a new StringBuilder object.
    Dim builder As New System.Text.StringBuilder()

    ' Create the StringWriter object with the StringBuilder object.
    Dim writer As 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())
End Sub

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

WriteXmlSchema(String)

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

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

public:
 void WriteXmlSchema(System::String ^ fileName);
public void WriteXmlSchema (string fileName);
member this.WriteXmlSchema : string -> unit
Public Sub WriteXmlSchema (fileName As String)

Parameters

fileName
String

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

Exceptions

Examples

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);
}
Private Sub WriteSchemaToFile(thisDataSet As DataSet)
    ' Set the file path and name. Modify this for your purposes.
    Dim filename As String = "Schema.xml"

    ' Write the schema to the file.
    thisDataSet.WriteXmlSchema(filename)
End Sub

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

WriteXmlSchema(XmlWriter)

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

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

public:
 void WriteXmlSchema(System::Xml::XmlWriter ^ writer);
public void WriteXmlSchema (System.Xml.XmlWriter? writer);
public void WriteXmlSchema (System.Xml.XmlWriter writer);
member this.WriteXmlSchema : System.Xml.XmlWriter -> unit
Public Sub WriteXmlSchema (writer As XmlWriter)

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.

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();
}
Private Sub WriteSchemaWithXmlTextWriter(thisDataSet As DataSet)
    ' Set the file path and name. Modify this for your purposes.
    Dim filename As String = "SchemaDoc.xml"

    ' Create a FileStream object with the file path and name.
    Dim stream As New System.IO.FileStream _
       (filename, System.IO.FileMode.Create)

    ' Create a new XmlTextWriter object with the FileStream.
    Dim writer As New System.Xml.XmlTextWriter _
       (stream, System.Text.Encoding.Unicode)

    ' Write the schema into the DataSet and close the reader.
    thisDataSet.WriteXmlSchema(writer)
    writer.Close()
End Sub

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

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.

public:
 void WriteXmlSchema(System::IO::Stream ^ stream, Converter<Type ^, System::String ^> ^ multipleTargetConverter);
public void WriteXmlSchema (System.IO.Stream? stream, Converter<Type,string> multipleTargetConverter);
public void WriteXmlSchema (System.IO.Stream stream, Converter<Type,string> multipleTargetConverter);
member this.WriteXmlSchema : System.IO.Stream * Converter<Type, string> -> unit
Public Sub WriteXmlSchema (stream As Stream, multipleTargetConverter As Converter(Of Type, String))

Parameters

stream
Stream

A Stream object to write to.

multipleTargetConverter
Converter<Type,String>

A delegate used to convert Type to string.

Applies to

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.

public:
 void WriteXmlSchema(System::IO::TextWriter ^ writer, Converter<Type ^, System::String ^> ^ multipleTargetConverter);
public void WriteXmlSchema (System.IO.TextWriter? writer, Converter<Type,string> multipleTargetConverter);
public void WriteXmlSchema (System.IO.TextWriter writer, Converter<Type,string> multipleTargetConverter);
member this.WriteXmlSchema : System.IO.TextWriter * Converter<Type, string> -> unit
Public Sub WriteXmlSchema (writer As TextWriter, multipleTargetConverter As Converter(Of Type, String))

Parameters

writer
TextWriter

A TextWriter object to write to.

multipleTargetConverter
Converter<Type,String>

A delegate used to convert Type to string.

Applies to

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.

public:
 void WriteXmlSchema(System::Xml::XmlWriter ^ writer, Converter<Type ^, System::String ^> ^ multipleTargetConverter);
public void WriteXmlSchema (System.Xml.XmlWriter? writer, Converter<Type,string> multipleTargetConverter);
public void WriteXmlSchema (System.Xml.XmlWriter writer, Converter<Type,string> multipleTargetConverter);
member this.WriteXmlSchema : System.Xml.XmlWriter * Converter<Type, string> -> unit
Public Sub WriteXmlSchema (writer As XmlWriter, multipleTargetConverter As Converter(Of Type, String))

Parameters

writer
XmlWriter

A XmlWriter object to write to.

multipleTargetConverter
Converter<Type,String>

A delegate used to convert Type to string.

Applies to