DataSet.WriteXmlSchema Метод

Определение

Записывает структуру класса DataSet в виде XML-схемы.

Перегрузки

WriteXmlSchema(String, Converter<Type,String>)

Записывает структуру класса DataSet в виде XML-схемы в файл.

WriteXmlSchema(Stream)

Записывает структуру DataSet в качестве XML-схемы для указанного объекта Stream.

WriteXmlSchema(TextWriter)

Записывает структуру DataSet в качестве XML-схемы для указанного объекта TextWriter.

WriteXmlSchema(String)

Записывает структуру класса DataSet в виде XML-схемы в файл.

WriteXmlSchema(XmlWriter)

Записывает структуру класса DataSet в виде XML-схемы в объект XmlWriter.

WriteXmlSchema(Stream, Converter<Type,String>)

Записывает структуру DataSet в качестве XML-схемы для указанного объекта Stream.

WriteXmlSchema(TextWriter, Converter<Type,String>)

Записывает структуру DataSet в виде схемы XML для указанного объекта TextWriter.

WriteXmlSchema(XmlWriter, Converter<Type,String>)

Записывает структуру DataSet в виде схемы XML для указанного объекта XmlWriter.

WriteXmlSchema(String, Converter<Type,String>)

Записывает структуру класса DataSet в виде XML-схемы в файл.

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

Параметры

fileName
String

Имя файла для записи.

multipleTargetConverter
Converter<Type,String>

Делегат, используемый для преобразования Type в строковый формат.

Применяется к

WriteXmlSchema(Stream)

Записывает структуру DataSet в качестве XML-схемы для указанного объекта Stream.

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)

Параметры

stream
Stream

Объект Stream, используемый для записи в файл.

Примеры

В следующем примере создается новый FileStream объект, передаваемый методу WriteXmlSchema для записи схемы на диск.

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

Комментарии

WriteXmlSchema Используйте метод для записи схемы в DataSet XML-документ. Схема включает определения таблиц, отношений и ограничений. Чтобы написать схему в XML-документ, используйте WriteXmlSchema метод.

Xml-схема записывается с помощью стандарта XSD.

Чтобы записать данные в XML-документ, используйте WriteXml метод.

Классы, производные Stream от класса, включают BufferedStream, FileStreamMemoryStreamи NetworkStream.

См. также раздел

Применяется к

WriteXmlSchema(TextWriter)

Записывает структуру DataSet в качестве XML-схемы для указанного объекта TextWriter.

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)

Параметры

writer
TextWriter

Объект TextWriter, используемый для записи.

Примеры

В следующем примере создается System.Text.StringBuilder объект, который используется для создания нового System.IO.StringWriter. Передается StringWriter методу WriteXmlSchema , и результирующая строка выводится в окно консоли.

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

Комментарии

WriteXmlSchema Используйте метод для записи схемы в DataSet XML-документ. Схема включает определения таблиц, отношений и ограничений. Чтобы написать схему в XML-документ, используйте WriteXmlSchema метод.

Xml-схема записывается с помощью стандарта XSD.

Чтобы записать данные в XML-документ, используйте WriteXml метод.

Классы, производные от System.IO.TextWriter класса, включают System.Web.HttpWriter, System.CodeDom.Compiler.IndentedTextWriter, System.Web.UI.HtmlTextWriterи System.IO.StreamWriterSystem.IO.StringWriter.

См. также раздел

Применяется к

WriteXmlSchema(String)

Записывает структуру класса DataSet в виде XML-схемы в файл.

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

Параметры

fileName
String

Имя файла (включая путь), в который производится запись.

Исключения

Для поля FileIOPermission не задан класс Write.

Примеры

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

Комментарии

WriteXmlSchema Используйте метод для записи схемы в DataSet XML-документ. Схема включает определения таблиц, отношений и ограничений. Чтобы написать схему в XML-документ, используйте WriteXmlSchema метод.

Xml-схема записывается с помощью стандарта XSD.

Чтобы записать данные в XML-документ, используйте WriteXml метод.

См. также раздел

Применяется к

WriteXmlSchema(XmlWriter)

Записывает структуру класса DataSet в виде XML-схемы в объект 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)

Параметры

writer
XmlWriter

Экземпляр XmlWriter, в который выполняется запись.

Примеры

В следующем примере создается новый System.IO.FileStream объект с указанным путем. Объект FileStream используется для создания XmlTextWriter объекта. Затем WriteXmlSchema метод вызывается с XmlTextWriter объектом для записи схемы на диск.

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

Комментарии

WriteXmlSchema Используйте метод для записи схемы в DataSet XML-документ. Схема включает определения таблиц, отношений и ограничений. Чтобы записать схему в XML-документ, используйте WriteXmlSchema метод.

Xml-схема записывается с помощью стандарта XSD.

Чтобы записать данные в XML-документ, используйте WriteXml метод.

Один класс, наследующий от System.Xml.XmlWriter класса, — это XmlTextWriter класс.

См. также раздел

Применяется к

WriteXmlSchema(Stream, Converter<Type,String>)

Записывает структуру DataSet в качестве XML-схемы для указанного объекта Stream.

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

Параметры

stream
Stream

Объект Stream, в который осуществляется запись.

multipleTargetConverter
Converter<Type,String>

Делегат, используемый для преобразования Type в строковый формат.

Применяется к

WriteXmlSchema(TextWriter, Converter<Type,String>)

Записывает структуру DataSet в виде схемы XML для указанного объекта 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))

Параметры

writer
TextWriter

Объект TextWriter, в который осуществляется запись.

multipleTargetConverter
Converter<Type,String>

Делегат, используемый для преобразования Type в строковый формат.

Применяется к

WriteXmlSchema(XmlWriter, Converter<Type,String>)

Записывает структуру DataSet в виде схемы XML для указанного объекта 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))

Параметры

writer
XmlWriter

Объект XmlWriter, в который осуществляется запись.

multipleTargetConverter
Converter<Type,String>

Делегат, используемый для преобразования Type в строковый формат.

Применяется к