DataSet.WriteXmlSchema メソッド

定義

DataSet 構造体を XML スキーマとして書き込みます。

オーバーロード

WriteXmlSchema(String, Converter<Type,String>)

DataSet 構造体を XML スキーマとしてファイルに書き込みます。

WriteXmlSchema(Stream)

XML スキーマとして DataSet 構造体を指定した Stream オブジェクトに書き込みます。

WriteXmlSchema(TextWriter)

XML スキーマとして DataSet 構造体を指定した TextWriter オブジェクトに書き込みます。

WriteXmlSchema(String)

DataSet 構造体を XML スキーマとしてファイルに書き込みます。

WriteXmlSchema(XmlWriter)

DataSet 構造体を XML スキーマとして XmlWriter オブジェクトに書き込みます。

WriteXmlSchema(Stream, Converter<Type,String>)

XML スキーマとして DataSet 構造体を指定した Stream オブジェクトに書き込みます。

WriteXmlSchema(TextWriter, Converter<Type,String>)

指定した DataSet に対し、TextWriter 構造体を XML スキーマとして書き込みます。

WriteXmlSchema(XmlWriter, Converter<Type,String>)

指定した DataSet に対し、XmlWriter 構造体を XML スキーマとして書き込みます。

WriteXmlSchema(String, Converter<Type,String>)

ソース:
DataSet.cs
ソース:
DataSet.cs
ソース:
DataSet.cs

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.cs
ソース:
DataSet.cs
ソース:
DataSet.cs

XML スキーマとして DataSet 構造体を指定した 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、、MemoryStreamFileStream、および NetworkStreamが含まれますBufferedStream

こちらもご覧ください

適用対象

WriteXmlSchema(TextWriter)

ソース:
DataSet.cs
ソース:
DataSet.cs
ソース:
DataSet.cs

XML スキーマとして DataSet 構造体を指定した 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.TextWriterSystem.CodeDom.Compiler.IndentedTextWriterSystem.Web.HttpWriterSystem.Web.UI.HtmlTextWriterSystem.IO.StreamWriter、および System.IO.StringWriterが含まれます。

こちらもご覧ください

適用対象

WriteXmlSchema(String)

ソース:
DataSet.cs
ソース:
DataSet.cs
ソース:
DataSet.cs

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

書き込み先の (パスを含む) ファイル名。

例外

FileIOPermissionWrite に設定されていません。

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.cs
ソース:
DataSet.cs
ソース:
DataSet.cs

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 1 つは、 XmlTextWriter クラスです。

こちらもご覧ください

適用対象

WriteXmlSchema(Stream, Converter<Type,String>)

ソース:
DataSet.cs
ソース:
DataSet.cs
ソース:
DataSet.cs

XML スキーマとして DataSet 構造体を指定した 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.cs
ソース:
DataSet.cs
ソース:
DataSet.cs

指定した DataSet に対し、TextWriter 構造体を XML スキーマとして書き込みます。

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.cs
ソース:
DataSet.cs
ソース:
DataSet.cs

指定した DataSet に対し、XmlWriter 構造体を XML スキーマとして書き込みます。

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 を文字列に変換するために使用するデリゲート。

適用対象