DataTable.WriteXmlSchema 메서드

정의

XML 스키마로 현재 DataTable 데이터 구조를 씁니다.

오버로드

Name Description
WriteXmlSchema(Stream)

XML 스키마의 DataTable 현재 데이터 구조를 지정된 스트림에 씁니다.

WriteXmlSchema(TextWriter)

지정된 TextWriter을 사용하여 XML 스키마로 현재 데이터 구조를 DataTable 씁니다.

WriteXmlSchema(String)

XML 스키마의 현재 데이터 구조를 DataTable 지정된 파일에 씁니다.

WriteXmlSchema(XmlWriter)

지정된 XmlWriter을 사용하여 XML 스키마로 현재 데이터 구조를 DataTable 씁니다.

WriteXmlSchema(Stream, Boolean)

XML 스키마의 DataTable 현재 데이터 구조를 지정된 스트림에 씁니다. 테이블 및 모든 하위 항목에 대한 스키마를 저장하려면 매개 변수truewriteHierarchy .로 설정합니다.

WriteXmlSchema(TextWriter, Boolean)

지정된 TextWriter을 사용하여 XML 스키마로 현재 데이터 구조를 DataTable 씁니다. 테이블 및 모든 하위 항목에 대한 스키마를 저장하려면 매개 변수truewriteHierarchy .로 설정합니다.

WriteXmlSchema(XmlWriter, Boolean)

지정된 XmlWriter을 사용하여 XML 스키마로 현재 데이터 구조를 DataTable 씁니다. 테이블 및 모든 하위 항목에 대한 스키마를 저장하려면 매개 변수truewriteHierarchy .로 설정합니다.

WriteXmlSchema(String, Boolean)

XML 스키마의 현재 데이터 구조를 DataTable 지정된 파일에 씁니다. 테이블 및 모든 하위 항목에 대한 스키마를 저장하려면 매개 변수truewriteHierarchy .로 설정합니다.

예제

다음 콘솔 애플리케이션은 두 개의 DataTable 인스턴스를 만들고, 각각에 DataSet추가하고, 두 테이블과 관련된 테이블을 만든 다음, 이 메서드를 사용하여 WriteXmlSchema 부모 테이블에 포함된 데이터를 1TextWriter에 씁니다DataRelation. 이 예제에서는 매개 변수를 각 값으로 writeHierarchy 설정할 때의 동작을 보여 줍니다.

메모

이 예제에서는 사용할 수 있는 다른 예제의 WriteXmlSchema 오버로드된 버전 중 하나를 사용하는 방법을 보여 줍니다. 개별 오버로드 항목을 참조하세요.

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());
}
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

이 예제에서는 콘솔 창에 다음 출력을 표시합니다.

==============================
Customer table, without hierarchy
==============================
<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="NewDataSet" 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 id="NewDataSet" 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>

설명

메서드를 WriteXmlSchema 사용하여 XML 문서에 대한 스키마를 DataTable 작성합니다. 스키마에는 테이블, 관계 및 제약 조건 정의가 포함됩니다.

XML 스키마는 XSD 표준을 사용하여 작성됩니다.

XML 문서에 데이터를 쓰려면 이 메서드를 WriteXml 사용합니다.

WriteXmlSchema(Stream)

XML 스키마의 DataTable 현재 데이터 구조를 지정된 스트림에 씁니다.

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

XML 스키마를 쓸 스트림입니다.

설명

메서드를 WriteXmlSchema 사용하여 XML 문서에 대한 스키마를 DataTable 작성합니다. 스키마에는 테이블, 관계 및 제약 조건 정의가 포함됩니다.

XML 스키마는 XSD 표준을 사용하여 작성됩니다.

XML 문서에 데이터를 쓰려면 이 메서드를 WriteXml 사용합니다.

추가 정보

적용 대상

WriteXmlSchema(TextWriter)

지정된 TextWriter을 사용하여 XML 스키마로 현재 데이터 구조를 DataTable 씁니다.

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 쓸 작업입니다.

설명

메서드를 WriteXmlSchema 사용하여 XML 문서에 대한 스키마를 DataTable 작성합니다. 스키마에는 테이블, 관계 및 제약 조건 정의가 포함됩니다.

XML 스키마는 XSD 표준을 사용하여 작성됩니다.

XML 문서에 데이터를 쓰려면 이 메서드를 WriteXml 사용합니다.

추가 정보

적용 대상

WriteXmlSchema(String)

XML 스키마의 현재 데이터 구조를 DataTable 지정된 파일에 씁니다.

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

매개 변수

fileName
String

사용할 파일의 이름입니다.

설명

메서드를 WriteXmlSchema 사용하여 XML 문서에 대한 스키마를 DataTable 작성합니다. 스키마에는 테이블, 관계 및 제약 조건 정의가 포함됩니다.

XML 스키마는 XSD 표준을 사용하여 작성됩니다.

XML 문서에 데이터를 쓰려면 이 메서드를 WriteXml 사용합니다.

추가 정보

적용 대상

WriteXmlSchema(XmlWriter)

지정된 XmlWriter을 사용하여 XML 스키마로 현재 데이터 구조를 DataTable 씁니다.

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 사용할 수 있습니다.

설명

메서드를 WriteXmlSchema 사용하여 XML 문서에 대한 스키마를 DataTable 작성합니다. 스키마에는 테이블, 관계 및 제약 조건 정의가 포함됩니다.

XML 스키마는 XSD 표준을 사용하여 작성됩니다.

XML 문서에 데이터를 쓰려면 이 메서드를 WriteXml 사용합니다.

추가 정보

적용 대상

WriteXmlSchema(Stream, Boolean)

XML 스키마의 DataTable 현재 데이터 구조를 지정된 스트림에 씁니다. 테이블 및 모든 하위 항목에 대한 스키마를 저장하려면 매개 변수truewriteHierarchy .로 설정합니다.

public:
 void WriteXmlSchema(System::IO::Stream ^ stream, bool writeHierarchy);
public void WriteXmlSchema(System.IO.Stream stream, bool writeHierarchy);
member this.WriteXmlSchema : System.IO.Stream * bool -> unit
Public Sub WriteXmlSchema (stream As Stream, writeHierarchy As Boolean)

매개 변수

stream
Stream

XML 스키마를 쓸 스트림입니다.

writeHierarchy
Boolean

이 경우 true현재 테이블과 모든 하위 항목의 스키마를 작성합니다. 기본값인 경우 false 현재 테이블에 대한 스키마만 작성합니다.

설명

메서드를 WriteXmlSchema 사용하여 XML 문서에 대한 스키마를 DataTable 작성합니다. 스키마에는 테이블, 관계 및 제약 조건 정의가 포함됩니다.

XML 스키마는 XSD 표준을 사용하여 작성됩니다.

XML 문서에 데이터를 쓰려면 이 메서드를 WriteXml 사용합니다.

일반적으로 메서드는 WriteXmlSchema 현재 테이블에 대해서만 스키마를 씁니다. 현재 테이블과 해당 하위 테이블 전체의 관련 테이블에 대한 스키마를 작성하려면 매개 변수가 로 설정된 메서드를 writeHierarchy 호출합니다 true.

추가 정보

적용 대상

WriteXmlSchema(TextWriter, Boolean)

지정된 TextWriter을 사용하여 XML 스키마로 현재 데이터 구조를 DataTable 씁니다. 테이블 및 모든 하위 항목에 대한 스키마를 저장하려면 매개 변수truewriteHierarchy .로 설정합니다.

public:
 void WriteXmlSchema(System::IO::TextWriter ^ writer, bool writeHierarchy);
public void WriteXmlSchema(System.IO.TextWriter writer, bool writeHierarchy);
member this.WriteXmlSchema : System.IO.TextWriter * bool -> unit
Public Sub WriteXmlSchema (writer As TextWriter, writeHierarchy As Boolean)

매개 변수

writer
TextWriter

TextWriter 쓸 작업입니다.

writeHierarchy
Boolean

이 경우 true현재 테이블과 모든 하위 항목의 스키마를 작성합니다. 기본값인 경우 false 현재 테이블에 대한 스키마만 작성합니다.

예제

다음 콘솔 애플리케이션은 두 개의 DataTable 인스턴스를 만들고, 각각에 DataSet추가하고, 두 테이블과 관련된 테이블을 만든 다음, 이 메서드를 사용하여 WriteXmlSchema 부모 테이블에 포함된 데이터를 1TextWriter에 씁니다DataRelation. 이 예제에서는 매개 변수를 각 값으로 writeHierarchy 설정할 때의 동작을 보여 줍니다.

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());
}
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

이 예제에서는 콘솔 창에 다음 출력을 표시합니다.

==============================
Customer table, without hierarchy
==============================
<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="NewDataSet" 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 id="NewDataSet" 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>

설명

메서드를 WriteXmlSchema 사용하여 XML 문서에 대한 스키마를 DataTable 작성합니다. 스키마에는 테이블, 관계 및 제약 조건 정의가 포함됩니다.

XML 스키마는 XSD 표준을 사용하여 작성됩니다.

XML 문서에 데이터를 쓰려면 이 메서드를 WriteXml 사용합니다.

일반적으로 메서드는 WriteXmlSchema 현재 테이블에 대해서만 스키마를 씁니다. 현재 테이블과 해당 하위 테이블 전체의 관련 테이블에 대한 스키마를 작성하려면 매개 변수가 로 설정된 메서드를 writeHierarchy 호출합니다 true.

추가 정보

적용 대상

WriteXmlSchema(XmlWriter, Boolean)

지정된 XmlWriter을 사용하여 XML 스키마로 현재 데이터 구조를 DataTable 씁니다. 테이블 및 모든 하위 항목에 대한 스키마를 저장하려면 매개 변수truewriteHierarchy .로 설정합니다.

public:
 void WriteXmlSchema(System::Xml::XmlWriter ^ writer, bool writeHierarchy);
public void WriteXmlSchema(System.Xml.XmlWriter writer, bool writeHierarchy);
member this.WriteXmlSchema : System.Xml.XmlWriter * bool -> unit
Public Sub WriteXmlSchema (writer As XmlWriter, writeHierarchy As Boolean)

매개 변수

writer
XmlWriter

XmlWriter 문서를 작성하는 데 사용되는 문서입니다.

writeHierarchy
Boolean

이 경우 true현재 테이블과 모든 하위 항목의 스키마를 작성합니다. 기본값인 경우 false 현재 테이블에 대한 스키마만 작성합니다.

설명

메서드를 WriteXmlSchema 사용하여 XML 문서에 대한 스키마를 DataTable 작성합니다. 스키마에는 테이블, 관계 및 제약 조건 정의가 포함됩니다.

XML 스키마는 XSD 표준을 사용하여 작성됩니다.

XML 문서에 데이터를 쓰려면 이 메서드를 WriteXml 사용합니다.

일반적으로 메서드는 WriteXmlSchema 현재 테이블에 대해서만 스키마를 씁니다. 현재 테이블과 해당 하위 테이블 전체의 관련 테이블에 대한 스키마를 작성하려면 매개 변수가 로 설정된 메서드를 writeHierarchy 호출합니다 true.

추가 정보

적용 대상

WriteXmlSchema(String, Boolean)

XML 스키마의 현재 데이터 구조를 DataTable 지정된 파일에 씁니다. 테이블 및 모든 하위 항목에 대한 스키마를 저장하려면 매개 변수truewriteHierarchy .로 설정합니다.

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

매개 변수

fileName
String

사용할 파일의 이름입니다.

writeHierarchy
Boolean

이 경우 true현재 테이블과 모든 하위 항목의 스키마를 작성합니다. 기본값인 경우 false 현재 테이블에 대한 스키마만 작성합니다.

설명

메서드를 WriteXmlSchema 사용하여 XML 문서에 대한 스키마를 DataTable 작성합니다. 스키마에는 테이블, 관계 및 제약 조건 정의가 포함됩니다.

XML 스키마는 XSD 표준을 사용하여 작성됩니다.

XML 문서에 데이터를 쓰려면 이 메서드를 WriteXml 사용합니다.

일반적으로 메서드는 WriteXmlSchema 현재 테이블에 대해서만 스키마를 씁니다. 현재 테이블과 해당 하위 테이블 전체의 관련 테이블에 대한 스키마를 작성하려면 매개 변수가 로 설정된 메서드를 writeHierarchy 호출합니다 true.

추가 정보

적용 대상