DataSet.WriteXmlSchema Method

Definition

Scrive la struttura dell'oggetto DataSet come schema XML.Writes the DataSet structure as an XML schema.

Overloads

WriteXmlSchema(String, Converter<Type,String>)

Scrive la struttura dell'oggetto DataSet come schema XML in un file.Writes the DataSet structure as an XML schema to a file.

WriteXmlSchema(Stream)

Scrive la struttura DataSet come schema XML nell'oggetto Stream specificato.Writes the DataSet structure as an XML schema to the specified Stream object.

WriteXmlSchema(TextWriter)

Scrive la struttura DataSet come schema XML nell'oggetto TextWriter specificato.Writes the DataSet structure as an XML schema to the specified TextWriter object.

WriteXmlSchema(String)

Scrive la struttura dell'oggetto DataSet come schema XML in un file.Writes the DataSet structure as an XML schema to a file.

WriteXmlSchema(XmlWriter)

Scrive la struttura dell'oggetto DataSet come schema XML in un oggetto XmlWriter.Writes the DataSet structure as an XML schema to an XmlWriter object.

WriteXmlSchema(Stream, Converter<Type,String>)

Scrive la struttura DataSet come schema XML nell'oggetto Stream specificato.Writes the DataSet structure as an XML schema to the specified Stream object.

WriteXmlSchema(TextWriter, Converter<Type,String>)

Scrive la struttura di DataSet come XML Schema nell'oggetto TextWriter specificato.Writes the DataSet structure as an XML schema to the specified TextWriter.

WriteXmlSchema(XmlWriter, Converter<Type,String>)

Scrive la struttura di DataSet come XML Schema nell'oggetto XmlWriter specificato.Writes the DataSet structure as an XML schema to the specified XmlWriter.

WriteXmlSchema(String, Converter<Type,String>)

Scrive la struttura dell'oggetto DataSet come schema XML in un file.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

Nome del file in cui scrivere.The name of the file to write to.

multipleTargetConverter
Converter<Type,String>

Delegato utilizzato per convertire Type in stringa.A delegate used to convert Type to string.

WriteXmlSchema(Stream)

Scrive la struttura DataSet come schema XML nell'oggetto Stream specificato.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);
member this.WriteXmlSchema : System.IO.Stream -> unit
Public Sub WriteXmlSchema (stream As Stream)

Parameters

stream
Stream

Oggetto Stream utilizzato per scrivere in un file.A Stream object used to write to a file.

Examples

Nell'esempio seguente viene creato un nuovo oggetto FileStream passato al metodo WriteXmlSchema per scrivere lo schema su disco.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

Utilizzare il metodo WriteXmlSchema per scrivere lo schema per un DataSet in un documento XML.Use the WriteXmlSchema method to write the schema for a DataSet to an XML document. Lo schema include le definizioni di tabella, relazione e vincolo.The schema includes table, relation, and constraint definitions. Per scrivere uno schema in un documento XML, usare il metodo WriteXmlSchema.To write a schema to an XML document, use the WriteXmlSchema method.

Il XML Schema viene scritto utilizzando lo standard XSD.The XML schema is written using the XSD standard.

Per scrivere i dati in un documento XML, usare il metodo WriteXml.To write the data to an XML document, use the WriteXml method.

Le classi che derivano dalla classe Stream includono BufferedStream, FileStream, MemoryStreame NetworkStream.Classes that derive from the Stream class include BufferedStream, FileStream, MemoryStream, and NetworkStream.

See also

WriteXmlSchema(TextWriter)

Scrive la struttura DataSet come schema XML nell'oggetto TextWriter specificato.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);
member this.WriteXmlSchema : System.IO.TextWriter -> unit
Public Sub WriteXmlSchema (writer As TextWriter)

Parameters

writer
TextWriter

Oggetto TextWriter con cui eseguire operazioni di scrittura.The TextWriter object with which to write.

Examples

Nell'esempio seguente viene creato un oggetto System.Text.StringBuilder a usato per creare una nuova System.IO.StringWriter.The following example creates a System.Text.StringBuilder object to that is used to create a new System.IO.StringWriter. Il StringWriter viene passato al metodo WriteXmlSchema e la stringa risultante viene stampata nella finestra della console.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

Utilizzare il metodo WriteXmlSchema per scrivere lo schema per un DataSet in un documento XML.Use the WriteXmlSchema method to write the schema for a DataSet to an XML document. Lo schema include le definizioni di tabella, relazione e vincolo.The schema includes table, relation, and constraint definitions. Per scrivere uno schema in un documento XML, usare il metodo WriteXmlSchema.To write a schema to an XML document, use the WriteXmlSchema method.

Il XML Schema viene scritto utilizzando lo standard XSD.The XML schema is written using the XSD standard.

Per scrivere i dati in un documento XML, usare il metodo WriteXml.To write the data to an XML document, use the WriteXml method.

Le classi che derivano dalla classe System.IO.TextWriter includono System.Web.HttpWriter, System.CodeDom.Compiler.IndentedTextWriter, System.Web.UI.HtmlTextWriter, System.IO.StreamWritere System.IO.StringWriter.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

WriteXmlSchema(String)

Scrive la struttura dell'oggetto DataSet come schema XML in un file.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

Nome del file, incluso il percorso, in cui scrivere.The file name (including the path) to which to write.

Exceptions

La classe FileIOPermission non è impostata su Write.FileIOPermission is not set to Write.

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

Utilizzare il metodo WriteXmlSchema per scrivere lo schema per un DataSet in un documento XML.Use the WriteXmlSchema method to write the schema for a DataSet to an XML document. Lo schema include le definizioni di tabella, relazione e vincolo.The schema includes table, relation, and constraint definitions. Per scrivere uno schema in un documento XML, usare il metodo WriteXmlSchema.To write a schema to an XML document, use the WriteXmlSchema method.

Il XML Schema viene scritto utilizzando lo standard XSD.The XML schema is written using the XSD standard.

Per scrivere i dati in un documento XML, usare il metodo WriteXml.To write the data to an XML document, use the WriteXml method.

See also

WriteXmlSchema(XmlWriter)

Scrive la struttura dell'oggetto DataSet come schema XML in un oggetto XmlWriter.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);
member this.WriteXmlSchema : System.Xml.XmlWriter -> unit
Public Sub WriteXmlSchema (writer As XmlWriter)

Parameters

writer
XmlWriter

Oggetto XmlWriter in cui scrivere.The XmlWriter to write to.

Examples

Nell'esempio seguente viene creato un nuovo oggetto System.IO.FileStream con il percorso specificato.The following example creates a new System.IO.FileStream object with the specified path. L'oggetto FileStream viene utilizzato per creare un oggetto XmlTextWriter.The FileStream object is used to create an XmlTextWriter object. Il metodo WriteXmlSchema viene quindi richiamato con l'oggetto XmlTextWriter per scrivere lo schema sul disco.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

Utilizzare il metodo WriteXmlSchema per scrivere lo schema per un DataSet in un documento XML.Use the WriteXmlSchema method to write the schema for a DataSet to an XML document. Lo schema include le definizioni di tabella, relazione e vincolo.The schema includes table, relation, and constraint definitions. Per scrivere uno schema in un documento XML, usare il metodo WriteXmlSchema.To write a schema to an XML document, use the WriteXmlSchema method.

Il XML Schema viene scritto utilizzando lo standard XSD.The XML schema is written using the XSD standard.

Per scrivere i dati in un documento XML, usare il metodo WriteXml.To write the data to an XML document, use the WriteXml method.

Una classe che eredita dalla classe System.Xml.XmlWriter è la classe XmlTextWriter.One class that inherits from the System.Xml.XmlWriter class is the XmlTextWriter class.

See also

WriteXmlSchema(Stream, Converter<Type,String>)

Scrive la struttura DataSet come schema XML nell'oggetto Stream specificato.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);
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

Oggetto Stream in cui scrivere.A Stream object to write to.

multipleTargetConverter
Converter<Type,String>

Delegato utilizzato per convertire Type in stringa.A delegate used to convert Type to string.

WriteXmlSchema(TextWriter, Converter<Type,String>)

Scrive la struttura di DataSet come XML Schema nell'oggetto TextWriter specificato.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);
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

Oggetto TextWriter in cui scrivere.A TextWriter object to write to.

multipleTargetConverter
Converter<Type,String>

Delegato utilizzato per convertire Type in stringa.A delegate used to convert Type to string.

WriteXmlSchema(XmlWriter, Converter<Type,String>)

Scrive la struttura di DataSet come XML Schema nell'oggetto XmlWriter specificato.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);
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

Oggetto XmlWriter in cui scrivere.A XmlWriter object to write to.

multipleTargetConverter
Converter<Type,String>

Delegato utilizzato per convertire Type in stringa.A delegate used to convert Type to string.

Applies to