DataSet.WriteXmlSchema Metoda

Definice

Zapíše DataSet strukturu jako schéma XML.

Přetížení

WriteXmlSchema(String, Converter<Type,String>)

Zapíše DataSet strukturu jako schéma XML do souboru.

WriteXmlSchema(Stream)

Zapíše DataSet strukturu jako schéma XML do zadaného Stream objektu.

WriteXmlSchema(TextWriter)

Zapíše DataSet strukturu jako schéma XML do zadaného TextWriter objektu.

WriteXmlSchema(String)

Zapíše DataSet strukturu jako schéma XML do souboru.

WriteXmlSchema(XmlWriter)

Zapíše DataSet strukturu jako schéma XML do objektu XmlWriter .

WriteXmlSchema(Stream, Converter<Type,String>)

Zapíše DataSet strukturu jako schéma XML do zadaného Stream objektu.

WriteXmlSchema(TextWriter, Converter<Type,String>)

Zapíše DataSet strukturu jako schéma XML do zadaného TextWriterobjektu .

WriteXmlSchema(XmlWriter, Converter<Type,String>)

Zapíše DataSet strukturu jako schéma XML do zadaného XmlWriterobjektu .

WriteXmlSchema(String, Converter<Type,String>)

Zdroj:
DataSet.cs
Zdroj:
DataSet.cs
Zdroj:
DataSet.cs

Zapíše DataSet strukturu jako schéma XML do souboru.

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))

Parametry

fileName
String

Název souboru, do který chcete zapisovat.

multipleTargetConverter
Converter<Type,String>

Delegát použitý k převodu Type na řetězec.

Platí pro

WriteXmlSchema(Stream)

Zdroj:
DataSet.cs
Zdroj:
DataSet.cs
Zdroj:
DataSet.cs

Zapíše DataSet strukturu jako schéma XML do zadaného Stream objektu.

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)

Parametry

stream
Stream

Objekt Stream použitý k zápisu do souboru.

Příklady

Následující příklad vytvoří nový FileStream objekt, který se předá WriteXmlSchema metodě pro zápis schématu na 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

Poznámky

Použijte metodu WriteXmlSchema k zápisu schématu DataSet pro do dokumentu XML. Schéma obsahuje definice tabulky, relace a omezení. K zápisu schématu do dokumentu XML použijte metodu WriteXmlSchema .

Schéma XML je zapsáno s použitím standardu XSD.

K zápisu dat do dokumentu XML použijte metodu WriteXml .

Mezi třídy odvozené z Stream třídy patří BufferedStream, FileStream, MemoryStreama NetworkStream.

Viz také

Platí pro

WriteXmlSchema(TextWriter)

Zdroj:
DataSet.cs
Zdroj:
DataSet.cs
Zdroj:
DataSet.cs

Zapíše DataSet strukturu jako schéma XML do zadaného TextWriter objektu.

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)

Parametry

writer
TextWriter

Objekt TextWriter , se kterým chcete psát.

Příklady

Následující příklad vytvoří System.Text.StringBuilder objekt , který slouží k vytvoření nového System.IO.StringWriterobjektu . Předá StringWriter se WriteXmlSchema metodě a výsledný řetězec se vytiskne do okna konzoly.

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

Poznámky

Použijte metodu WriteXmlSchema k zápisu schématu DataSet pro do dokumentu XML. Schéma obsahuje definice tabulky, relace a omezení. K zápisu schématu do dokumentu XML použijte metodu WriteXmlSchema .

Schéma XML je zapsáno s použitím standardu XSD.

K zápisu dat do dokumentu XML použijte metodu WriteXml .

Třídy odvozené z System.IO.TextWriter třídy zahrnují System.Web.HttpWriter, , System.CodeDom.Compiler.IndentedTextWriterSystem.Web.UI.HtmlTextWriter, System.IO.StreamWritera System.IO.StringWriter.

Viz také

Platí pro

WriteXmlSchema(String)

Zdroj:
DataSet.cs
Zdroj:
DataSet.cs
Zdroj:
DataSet.cs

Zapíše DataSet strukturu jako schéma XML do souboru.

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

Parametry

fileName
String

Název souboru (včetně cesty), do kterého se má zapisovat.

Výjimky

FileIOPermission není nastavená na Writehodnotu .

Příklady

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

Poznámky

Použijte metodu WriteXmlSchema k zápisu schématu DataSet pro do dokumentu XML. Schéma obsahuje definice tabulky, relace a omezení. K zápisu schématu do dokumentu XML použijte metodu WriteXmlSchema .

Schéma XML je zapsáno s použitím standardu XSD.

K zápisu dat do dokumentu XML použijte metodu WriteXml .

Viz také

Platí pro

WriteXmlSchema(XmlWriter)

Zdroj:
DataSet.cs
Zdroj:
DataSet.cs
Zdroj:
DataSet.cs

Zapíše DataSet strukturu jako schéma XML do objektu XmlWriter .

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)

Parametry

writer
XmlWriter

Do XmlWriter které se má zapisovat.

Příklady

Následující příklad vytvoří nový System.IO.FileStream objekt se zadanou cestou. Objekt slouží FileStream k vytvoření objektu XmlTextWriter . Metoda WriteXmlSchema je pak vyvolána s objektem XmlTextWriter pro zápis schématu na 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

Poznámky

Použijte metodu WriteXmlSchema k zápisu schématu DataSet pro do dokumentu XML. Schéma obsahuje definice tabulky, relace a omezení. K zápisu schématu do dokumentu XML použijte metodu WriteXmlSchema .

Schéma XML je zapsáno s použitím standardu XSD.

K zápisu dat do dokumentu XML použijte metodu WriteXml .

Jedna třída, která dědí z třídy , System.Xml.XmlWriterXmlTextWriter je třída .

Viz také

Platí pro

WriteXmlSchema(Stream, Converter<Type,String>)

Zdroj:
DataSet.cs
Zdroj:
DataSet.cs
Zdroj:
DataSet.cs

Zapíše DataSet strukturu jako schéma XML do zadaného Stream objektu.

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))

Parametry

stream
Stream

Objekt Stream , do který chcete zapisovat.

multipleTargetConverter
Converter<Type,String>

Delegát použitý k převodu Type na řetězec.

Platí pro

WriteXmlSchema(TextWriter, Converter<Type,String>)

Zdroj:
DataSet.cs
Zdroj:
DataSet.cs
Zdroj:
DataSet.cs

Zapíše DataSet strukturu jako schéma XML do zadaného TextWriterobjektu .

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))

Parametry

writer
TextWriter

Objekt TextWriter , do který chcete zapisovat.

multipleTargetConverter
Converter<Type,String>

Delegát použitý k převodu Type na řetězec.

Platí pro

WriteXmlSchema(XmlWriter, Converter<Type,String>)

Zdroj:
DataSet.cs
Zdroj:
DataSet.cs
Zdroj:
DataSet.cs

Zapíše DataSet strukturu jako schéma XML do zadaného XmlWriterobjektu .

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))

Parametry

writer
XmlWriter

Objekt XmlWriter , do který chcete zapisovat.

multipleTargetConverter
Converter<Type,String>

Delegát použitý k převodu Type na řetězec.

Platí pro