DataTable.WriteXmlSchemaとは? わかりやすく解説

DataTable.WriteXmlSchema メソッド (String, Boolean)

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

DataTable の現在のデータ構造体を指定されファイルXML スキーマとして書き込みますテーブルスキーマその子孫をすべて保存するには、writeHierarchy パラメータtrue設定します

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Sub WriteXmlSchema ( _
    fileName As String, _
    writeHierarchy As Boolean _
)
Dim instance As DataTable
Dim fileName As String
Dim writeHierarchy As Boolean

instance.WriteXmlSchema(fileName, writeHierarchy)
public void WriteXmlSchema (
    string fileName,
    bool writeHierarchy
)
public:
void WriteXmlSchema (
    String^ fileName, 
    bool writeHierarchy
)
public void WriteXmlSchema (
    String fileName, 
    boolean writeHierarchy
)
public function WriteXmlSchema (
    fileName : String, 
    writeHierarchy : boolean
)

パラメータ

fileName

使用するファイルの名前。

writeHierarchy

true場合は、現在のテーブルその子孫スキーマ書き込みますfalse (既定値) の場合は、現在のテーブルスキーマのみを書き込みます

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DataTable.WriteXmlSchema メソッド (Stream, Boolean)

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

DataTable の現在のデータ構造体を指定されストリームXML スキーマとして書き込みますテーブルスキーマその子孫をすべて保存するには、writeHierarchy パラメータtrue設定します

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Sub WriteXmlSchema ( _
    stream As Stream, _
    writeHierarchy As Boolean _
)
Dim instance As DataTable
Dim stream As Stream
Dim writeHierarchy As Boolean

instance.WriteXmlSchema(stream, writeHierarchy)
public void WriteXmlSchema (
    Stream stream,
    bool writeHierarchy
)
public:
void WriteXmlSchema (
    Stream^ stream, 
    bool writeHierarchy
)
public void WriteXmlSchema (
    Stream stream, 
    boolean writeHierarchy
)
public function WriteXmlSchema (
    stream : Stream, 
    writeHierarchy : boolean
)

パラメータ

stream

XML スキーマ書き込まれストリーム

writeHierarchy

true場合は、現在のテーブルその子孫スキーマ書き込みますfalse (既定値) の場合は、現在のテーブルスキーマのみを書き込みます

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DataTable.WriteXmlSchema メソッド (String)

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

DataTable の現在のデータ構造体を指定されファイルXML スキーマとして書き込みます

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Sub WriteXmlSchema ( _
    fileName As String _
)
Dim instance As DataTable
Dim fileName As String

instance.WriteXmlSchema(fileName)
public void WriteXmlSchema (
    string fileName
)
public:
void WriteXmlSchema (
    String^ fileName
)
public void WriteXmlSchema (
    String fileName
)
public function WriteXmlSchema (
    fileName : String
)

パラメータ

fileName

使用するファイルの名前。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DataTable.WriteXmlSchema メソッド (TextWriter)

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

指定した TextWriter使用して、DataTable の現在のデータ構造体を XML スキーマとして書き込みます

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Sub WriteXmlSchema ( _
    writer As TextWriter _
)
Dim instance As DataTable
Dim writer As TextWriter

instance.WriteXmlSchema(writer)
public void WriteXmlSchema (
    TextWriter writer
)
public:
void WriteXmlSchema (
    TextWriter^ writer
)
public void WriteXmlSchema (
    TextWriter writer
)
public function WriteXmlSchema (
    writer : TextWriter
)

パラメータ

writer

書き込み使用する TextWriter

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DataTable.WriteXmlSchema メソッド

DataTable の現在のデータ構造体を XML スキーマとして書き込みます
オーバーロードの一覧オーバーロードの一覧

名前 説明
DataTable.WriteXmlSchema (Stream) DataTable現在のデータ構造体を指定されストリームXML スキーマとして書き込みます

.NET Compact Framework によってサポートされています。

DataTable.WriteXmlSchema (String) DataTable現在のデータ構造体を指定されファイルXML スキーマとして書き込みます

.NET Compact Framework によってサポートされています。

DataTable.WriteXmlSchema (TextWriter) 指定した TextWriter使用してDataTable現在のデータ構造体を XML スキーマとして書き込みます

.NET Compact Framework によってサポートされています。

DataTable.WriteXmlSchema (XmlWriter) 指定した XmlWriter使用してDataTable現在のデータ構造体を XML スキーマとして書き込みます

.NET Compact Framework によってサポートされています。

DataTable.WriteXmlSchema (Stream, Boolean) DataTable現在のデータ構造体を指定されストリームXML スキーマとして書き込みますテーブルスキーマその子孫をすべて保存するには、writeHierarchy パラメータtrue設定します

.NET Compact Framework によってサポートされています。

DataTable.WriteXmlSchema (String, Boolean) DataTable現在のデータ構造体を指定されファイルXML スキーマとして書き込みますテーブルスキーマその子孫をすべて保存するには、writeHierarchy パラメータtrue設定します

.NET Compact Framework によってサポートされています。

DataTable.WriteXmlSchema (TextWriter, Boolean) 指定した TextWriter使用してDataTable現在のデータ構造体を XML スキーマとして書き込みますテーブルスキーマその子孫をすべて保存するには、writeHierarchy パラメータtrue設定します

.NET Compact Framework によってサポートされています。

DataTable.WriteXmlSchema (XmlWriter, Boolean) 指定した XmlWriter使用してDataTable現在のデータ構造体を XML スキーマとして書き込みますテーブルスキーマその子孫をすべて保存するには、writeHierarchy パラメータtrue設定します

.NET Compact Framework によってサポートされています。

参照参照

関連項目

DataTable クラス
DataTable メンバ
System.Data 名前空間

その他の技術情報

DataTable の作成使用
DataTable の作成使用
DataTable の作成使用

DataTable.WriteXmlSchema メソッド (XmlWriter)

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

指定した XmlWriter使用して、DataTable の現在のデータ構造体を XML スキーマとして書き込みます

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Sub WriteXmlSchema ( _
    writer As XmlWriter _
)
Dim instance As DataTable
Dim writer As XmlWriter

instance.WriteXmlSchema(writer)
public void WriteXmlSchema (
    XmlWriter writer
)
public:
void WriteXmlSchema (
    XmlWriter^ writer
)
public void WriteXmlSchema (
    XmlWriter writer
)
public function WriteXmlSchema (
    writer : XmlWriter
)

パラメータ

writer

使用する XmlWriter

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DataTable.WriteXmlSchema メソッド (Stream)

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

DataTable の現在のデータ構造体を指定されストリームXML スキーマとして書き込みます

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Sub WriteXmlSchema ( _
    stream As Stream _
)
Dim instance As DataTable
Dim stream As Stream

instance.WriteXmlSchema(stream)
public void WriteXmlSchema (
    Stream stream
)
public:
void WriteXmlSchema (
    Stream^ stream
)
public void WriteXmlSchema (
    Stream stream
)
public function WriteXmlSchema (
    stream : Stream
)

パラメータ

stream

XML スキーマ書き込まれストリーム

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DataTable.WriteXmlSchema メソッド (TextWriter, Boolean)

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

指定した TextWriter使用して、DataTable の現在のデータ構造体を XML スキーマとして書き込みますテーブルスキーマその子孫をすべて保存するには、writeHierarchy パラメータtrue設定します

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Sub WriteXmlSchema ( _
    writer As TextWriter, _
    writeHierarchy As Boolean _
)
Dim instance As DataTable
Dim writer As TextWriter
Dim writeHierarchy As Boolean

instance.WriteXmlSchema(writer, writeHierarchy)
public void WriteXmlSchema (
    TextWriter writer,
    bool writeHierarchy
)
public:
void WriteXmlSchema (
    TextWriter^ writer, 
    bool writeHierarchy
)
public void WriteXmlSchema (
    TextWriter writer, 
    boolean writeHierarchy
)
public function WriteXmlSchema (
    writer : TextWriter, 
    writeHierarchy : boolean
)

パラメータ

writer

書き込み使用する TextWriter

writeHierarchy

true場合は、現在のテーブルその子孫スキーマ書き込みますfalse (既定値) の場合は、現在のテーブルスキーマのみを書き込みます

解説解説
使用例使用例

次のコンソール アプリケーションは、DataTableインスタンス2 つ作成しそれぞれDataSet追加して2 つテーブル関連する DataRelation を作成した後、WriteXmlSchema メソッド使用して、親テーブル格納されデータTextWriter書き込みます。この例では、writeHierarchy パラメータを、対応する個々の値に設定する際の動作示してます。

Sub Main()
  Dim ds As New DataSet
  Dim customerTable As DataTable = GetCustomers()
  Dim orderTable As DataTable = GetOrders()

  ds.Tables.Add(customerTable)
  ds.Tables.Add(orderTable)
  ds.Relations.Add("CustomerOrder", _
   New DataColumn() {customerTable.Columns(0)}, _
   New DataColumn() {orderTable.Columns(1)}, True)

  Dim writer As New System.IO.StringWriter
  customerTable.WriteXmlSchema(writer, False)
  PrintOutput(writer, "Customer table, without hierarchy")

  writer = New System.IO.StringWriter
  customerTable.WriteXmlSchema(writer, True)
  PrintOutput(writer, "Customer table, with hierarchy")

  Console.WriteLine("Press any key to continue.")
  Console.ReadKey()
End Sub

Private Function GetOrders() As
 DataTable
  ' Create sample Customers table, in order
  ' to demonstrate the behavior of the DataTableReader.
  Dim table As New DataTable

  ' Create three columns, OrderID, CustomerID, and OrderDate.
  table.Columns.Add(New DataColumn("OrderID",
 GetType(System.Int32)))
  table.Columns.Add(New DataColumn("CustomerID",
 GetType(System.Int32)))
  table.Columns.Add(New DataColumn("OrderDate",
 GetType(System.DateTime)))

  ' Set the OrderID column as the primary key column.
  table.PrimaryKey = New DataColumn() {table.Columns(0)}

  table.Rows.Add(New Object() {1, 1, #12/2/2003#})
  table.Rows.Add(New Object() {2, 1, #1/3/2004#})
  table.Rows.Add(New Object() {3, 2, #11/13/2004#})
  table.Rows.Add(New Object() {4, 3, #5/16/2004#})
  table.Rows.Add(New Object() {5, 3, #5/22/2004#})
  table.Rows.Add(New Object() {6, 4, #6/15/2004#})
  table.AcceptChanges()
  Return table
End Function

Private Function GetCustomers() As
 DataTable
  ' Create sample Customers table, in order
  ' to demonstrate the behavior of the DataTableReader.
  Dim table As New DataTable

  ' Create two columns, ID and Name.
  Dim idColumn As DataColumn = table.Columns.Add("ID",
 _
      GetType(System.Int32))
  table.Columns.Add("Name", GetType(System.String))

  ' Set the ID column as the primary key column.
  table.PrimaryKey = New DataColumn() {idColumn}

  table.Rows.Add(New Object() {1, "Mary"})
  table.Rows.Add(New Object() {2, "Andy"})
  table.Rows.Add(New Object() {3, "Peter"})
  table.Rows.Add(New Object() {4, "Russ"})
  table.AcceptChanges()
  Return table
End Function

Private Sub PrintOutput( _
   ByVal writer As System.IO.TextWriter, ByVal
 caption As String)

  Console.WriteLine("==============================")
  Console.WriteLine(caption)
  Console.WriteLine("==============================")
  Console.WriteLine(writer.ToString())
End Sub
static void Main()
{
    DataSet ds = new DataSet();
    DataTable customerTable = GetCustomers();
    DataTable orderTable = GetOrders();

    ds.Tables.Add(customerTable);
    ds.Tables.Add(orderTable);
    ds.Relations.Add("CustomerOrder",
        new DataColumn[] { customerTable.Columns[0] },
        new DataColumn[] { orderTable.Columns[1] }, true);

    System.IO.StringWriter writer = new System.IO.StringWriter();
    customerTable.WriteXmlSchema(writer, false);
    PrintOutput(writer, "Customer table, without hierarchy");

    writer = new System.IO.StringWriter();
    customerTable.WriteXmlSchema(writer, true);
    PrintOutput(writer, "Customer table, with hierarchy");

    Console.WriteLine("Press any key to continue.");
    Console.ReadKey();
}

private static DataTable GetCustomers()
{
    // Create sample Customers table, in order
    // to demonstrate the behavior of the DataTableReader.
    DataTable table = new DataTable();

    // Create two columns, ID and Name.
    DataColumn idColumn = table.Columns.Add("ID", typeof(System.Int32));
    table.Columns.Add("Name", typeof(System.String));

    // Set the ID column as the primary key column.
    table.PrimaryKey = new DataColumn[] { idColumn };

    table.Rows.Add(new object[] { 1, "Mary" });
    table.Rows.Add(new object[] { 2, "Andy" });
    table.Rows.Add(new object[] { 3, "Peter" });
    table.Rows.Add(new object[] { 4, "Russ" });
    table.AcceptChanges();
    return table;
}

private static DataTable GetOrders()
{
    // Create sample Customers table, in order
    // to demonstrate the behavior of the DataTableReader.
    DataTable table = new DataTable();

    // Create three columns; OrderID, CustomerID, and OrderDate.
    table.Columns.Add(new DataColumn("OrderID", typeof(System.Int32)));
    table.Columns.Add(new DataColumn("CustomerID", typeof(System.Int32)));
    table.Columns.Add(new DataColumn("OrderDate", typeof(System.DateTime)));

    // Set the OrderID column as the primary key column.
    table.PrimaryKey = new DataColumn[] { table.Columns[0] };

    table.Rows.Add(new object[] { 1, 1, "12/2/2003"
 });
    table.Rows.Add(new object[] { 2, 1, "1/3/2004" });
    table.Rows.Add(new object[] { 3, 2, "11/13/2004"
 });
    table.Rows.Add(new object[] { 4, 3, "5/16/2004"
 });
    table.Rows.Add(new object[] { 5, 3, "5/22/2004"
 });
    table.Rows.Add(new object[] { 6, 4, "6/15/2004"
 });
    table.AcceptChanges();
    return table;
}

private static void PrintOutput(System.IO.TextWriter
 writer, string caption)
{
    Console.WriteLine("==============================");
    Console.WriteLine(caption);
    Console.WriteLine("==============================");
    Console.WriteLine(writer.ToString());
}

この例では、コンソール ウィンドウ次の出力表示します

==============================
Customer table, without hierarchy
==============================
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="Ta
ble1">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="Table1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="ID" type="xs:int" />
              <xs:element name="Name" type="xs:string" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
    <xs:unique name="Constraint1" msdata:PrimaryKey="true">
      <xs:selector xpath=".//Table1" />
      <xs:field xpath="ID" />
    </xs:unique>
  </xs:element>
</xs:schema>
==============================
Customer table, with hierarchy
==============================
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="Table1">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="Table1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="ID" type="xs:int" />
              <xs:element name="Name" type="xs:string" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="Table2">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="OrderID" type="xs:int" />
              <xs:element name="CustomerID" type="xs:int" minOccurs="0" />
              <xs:element name="OrderDate" type="xs:dateTime" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
    <xs:unique name="Constraint1" msdata:PrimaryKey="true">
      <xs:selector xpath=".//Table1" />
      <xs:field xpath="ID" />
    </xs:unique>
    <xs:unique name="Table2_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
      <xs:selector xpath=".//Table2" />
      <xs:field xpath="OrderID" />
    </xs:unique>
    <xs:keyref name="CustomerOrder" refer="Constraint1">
      <xs:selector xpath=".//Table2" />
      <xs:field xpath="CustomerID" />
    </xs:keyref>
  </xs:element>
</xs:schema>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DataTable.WriteXmlSchema メソッド (XmlWriter, Boolean)

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

指定した XmlWriter使用して、DataTable の現在のデータ構造体を XML スキーマとして書き込みますテーブルスキーマその子孫をすべて保存するには、writeHierarchy パラメータtrue設定します

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Sub WriteXmlSchema ( _
    writer As XmlWriter, _
    writeHierarchy As Boolean _
)
Dim instance As DataTable
Dim writer As XmlWriter
Dim writeHierarchy As Boolean

instance.WriteXmlSchema(writer, writeHierarchy)
public void WriteXmlSchema (
    XmlWriter writer,
    bool writeHierarchy
)
public:
void WriteXmlSchema (
    XmlWriter^ writer, 
    bool writeHierarchy
)
public void WriteXmlSchema (
    XmlWriter writer, 
    boolean writeHierarchy
)
public function WriteXmlSchema (
    writer : XmlWriter, 
    writeHierarchy : boolean
)

パラメータ

writer

ドキュメント書き込むために使用する XmlWriter

writeHierarchy

true場合は、現在のテーブルその子孫スキーマ書き込みますfalse (既定値) の場合は、現在のテーブルスキーマのみを書き込みます

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からDataTable.WriteXmlSchemaを検索した結果を表示しています。
Weblioに収録されているすべての辞書からDataTable.WriteXmlSchemaを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDataTable.WriteXmlSchema を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

カテゴリ一覧

すべての辞書の索引



Weblioのサービス

「DataTable.WriteXmlSchema」の関連用語


DataTable.WriteXmlSchemaのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataTable.WriteXmlSchemaのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS