DataSet.ReadXmlSchema 메서드

정의

XML 스키마를 읽습니다 DataSet.

오버로드

Name Description
ReadXmlSchema(Stream)

지정된 XML 스키마에서 .로 XML Stream 스키마를 읽습니다 DataSet.

ReadXmlSchema(TextReader)

지정된 XML 스키마에서 .로 XML TextReader 스키마를 읽습니다 DataSet.

ReadXmlSchema(String)

지정된 파일 DataSet에서 XML 스키마를 읽습니다.

ReadXmlSchema(XmlReader)

지정된 XML 스키마에서 .로 XML XmlReader 스키마를 읽습니다 DataSet.

ReadXmlSchema(Stream)

지정된 XML 스키마에서 .로 XML Stream 스키마를 읽습니다 DataSet.

public:
 void ReadXmlSchema(System::IO::Stream ^ stream);
public void ReadXmlSchema(System.IO.Stream stream);
member this.ReadXmlSchema : System.IO.Stream -> unit
Public Sub ReadXmlSchema (stream As Stream)

매개 변수

stream
Stream

Stream 읽을 원본입니다.

예제

다음 예제에서는 XML 스키마를 읽을 개체를 만들고 FileStream 개체를 사용하여 메서드를 ReadXmlSchema 호출합니다.

private void ReadSchemaFromFileStream(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,
    // and set to open the file.
    System.IO.FileStream stream =
        new System.IO.FileStream(filename,System.IO.FileMode.Open);

    // Read the schema into the DataSet.
    thisDataSet.ReadXmlSchema(stream);

    // Close the FileStream.
    stream.Close();
}
Private Sub ReadSchemaFromFileStream(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, 
    ' and set to open the file
    Dim stream As New System.IO.FileStream _
        (filename, System.IO.FileMode.Open)

    ' Read the schema into the DataSet.
    thisDataSet.ReadXmlSchema(stream)

    ' Close the FileStream.
    stream.Close()
End Sub

설명

메서드를 ReadXmlSchema 사용하여 에 대한 스키마를 만듭니다 DataSet. 스키마에는 테이블, 관계 및 제약 조건 정의가 포함됩니다. XML 문서에 스키마를 쓰려면 이 메서드를 WriteXmlSchema 사용합니다.

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

Note

msdata:DataType 및 xs:type 형식이 일치하지 않는 경우 데이터 손상이 발생할 수 있습니다. 예외가 throw되지 않습니다.

ReadXmlSchema 이 메서드는 일반적으로 를 채우는 데 사용되는 메서드를 ReadXml 호출하기 전에 호출됩니다DataSet.

클래스에서 Stream 파생되는 클래스에는 BufferedStream, FileStreamMemoryStreamNetworkStream.

Note

사용자의 스키마에 DataSet 이름이 같지만 형식이 다른 요소가 동일한 네임스페이스에 있는 경우 스키마를 withReadXmlSchema로 읽으려고 할 때 예외가 DataSet throw됩니다. .NET Framework 버전 1.0을 사용하는 경우에는 이 예외가 발생하지 않습니다.

추가 정보

적용 대상

ReadXmlSchema(TextReader)

지정된 XML 스키마에서 .로 XML TextReader 스키마를 읽습니다 DataSet.

public:
 void ReadXmlSchema(System::IO::TextReader ^ reader);
public void ReadXmlSchema(System.IO.TextReader reader);
member this.ReadXmlSchema : System.IO.TextReader -> unit
Public Sub ReadXmlSchema (reader As TextReader)

매개 변수

reader
TextReader

TextReader 읽을 원본입니다.

예제

다음 예제에서는 스키마를 StreamReader 읽을 개체를 만들고 개체를 사용하여 메서드를 ReadXmlSchema 호출합니다.

private void ReadSchemaFromStreamReader()
{
    // Create the DataSet to read the schema into.
    DataSet thisDataSet = new DataSet();

    // Set the file path and name. Modify this for your purposes.
    string filename="Schema.xml";

    // Create a StreamReader object with the file path and name.
    System.IO.StreamReader readStream =
        new System.IO.StreamReader(filename);

    // Invoke the ReadXmlSchema method with the StreamReader object.
    thisDataSet.ReadXmlSchema(readStream);

    // Close the StreamReader
    readStream.Close();
}
Private Sub ReadSchemaFromStreamReader()
    ' Create the DataSet to read the schema into.
    Dim thisDataSet As New DataSet()

    ' Set the file path and name. Modify this for your purposes.
    Dim filename As String = "Schema.xml"

    ' Create a StreamReader object with the file path and name.
    Dim readStream As New System.IO.StreamReader(filename)

    ' Invoke the ReadXmlSchema method with the StreamReader object.
    thisDataSet.ReadXmlSchema(readStream)

    ' Close the StreamReader
    readStream.Close()
End Sub

설명

메서드를 ReadXmlSchema 사용하여 에 대한 스키마를 만듭니다 DataSet. 스키마에는 테이블, 관계 및 제약 조건 정의가 포함됩니다. XML 문서에 스키마를 쓰려면 이 메서드를 WriteXmlSchema 사용합니다.

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

Note

msdata:DataType 및 xs:type 형식이 일치하지 않는 경우 데이터 손상이 발생할 수 있습니다. 예외가 throw되지 않습니다.

ReadXmlSchema 이 메서드는 일반적으로 를 채우는 데 사용되는 메서드를 ReadXml 호출하기 전에 호출됩니다DataSet.

클래스에서 TextReader 상속되는 클래스에는 클래스와 StringReader 클래스가 StreamReader 포함됩니다.

Note

사용자의 스키마에 DataSet 이름이 같지만 형식이 다른 요소가 동일한 네임스페이스에 있는 경우 스키마를 withReadXmlSchema로 읽으려고 할 때 예외가 DataSet throw됩니다. .NET Framework 버전 1.0을 사용하는 경우에는 이 예외가 발생하지 않습니다.

추가 정보

적용 대상

ReadXmlSchema(String)

지정된 파일 DataSet에서 XML 스키마를 읽습니다.

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

매개 변수

fileName
String

읽을 파일 이름(경로 포함)입니다.

예외

FileIOPermission 가 .로 Read설정되지 않았습니다.

예제

private void ReadSchemaFromFile(){
   // Create the DataSet to read the schema into.
   DataSet thisDataSet = new DataSet();

   // Set the file path and name. Modify this for your purposes.
   string filename="Schema.xml";

   // Invoke the ReadXmlSchema method with the file name.
   thisDataSet.ReadXmlSchema(filename);
}
Private Sub ReadSchemaFromFile()
    ' Create the DataSet to read the schema into.
    Dim thisDataSet As New DataSet()

    ' Set the file path and name. Modify this for your purposes.
    Dim filename As String = "Schema.xml"

    ' Invoke the ReadXmlSchema method with the file name.
    thisDataSet.ReadXmlSchema(filename)
End Sub

설명

메서드를 ReadXmlSchema 사용하여 에 대한 스키마를 만듭니다 DataSet. 스키마에는 테이블, 관계 및 제약 조건 정의가 포함됩니다. XML 문서에 스키마를 쓰려면 이 메서드를 WriteXmlSchema 사용합니다.

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

Note

msdata:DataType 및 xs:type 형식이 일치하지 않는 경우 데이터 손상이 발생할 수 있습니다. 예외가 throw되지 않습니다.

ReadXmlSchema 이 메서드는 일반적으로 를 채우는 데 사용되는 메서드를 ReadXml 호출하기 전에 호출됩니다DataSet.

Note

동일한 네임스페이스에 DataSet 이름이 같지만 형식이 다른 요소가 스키마에 포함된 경우 스키마를 withReadXmlSchema로 읽으려고 할 때 예외가 DataSet throw됩니다. .NET Framework 버전 1.0을 사용하는 경우에는 이 예외가 발생하지 않습니다.

추가 정보

적용 대상

ReadXmlSchema(XmlReader)

지정된 XML 스키마에서 .로 XML XmlReader 스키마를 읽습니다 DataSet.

public:
 void ReadXmlSchema(System::Xml::XmlReader ^ reader);
public void ReadXmlSchema(System.Xml.XmlReader reader);
member this.ReadXmlSchema : System.Xml.XmlReader -> unit
Public Sub ReadXmlSchema (reader As XmlReader)

매개 변수

reader
XmlReader

XmlReader 읽을 원본입니다.

예제

다음 예제에서는 새 DataSet 개체와 System.IO.FileStream 개체를 만듭니다. FileStream 파일 경로 및 파일 이름으로 만든 개체는 메서드에 인수로 전달되는 개체를 ReadXmlSchema 만드는 System.Xml.XmlTextReader 데 사용됩니다.

private void ReadSchemaFromXmlTextReader()
{
    // Create the DataSet to read the schema into.
    DataSet thisDataSet = new DataSet();

    // Set the file path and name. Modify this for your purposes.
    string filename="Schema.xml";

    // Create a FileStream object with the file path and name.
    System.IO.FileStream stream = new System.IO.FileStream
        (filename,System.IO.FileMode.Open);

    // Create a new XmlTextReader object with the FileStream.
    System.Xml.XmlTextReader xmlReader=
        new System.Xml.XmlTextReader(stream);

    // Read the schema into the DataSet and close the reader.
    thisDataSet.ReadXmlSchema(xmlReader);
    xmlReader.Close();
}
Private Sub ReadSchemaFromXmlTextReader()
    ' Create the DataSet to read the schema into.
    Dim thisDataSet As New DataSet()

    ' Set the file path and name. Modify this for your purposes.
    Dim filename As String = "Schema.xml"

    ' Create a FileStream object with the file path and name.
    Dim stream As New System.IO.FileStream _
       (filename, System.IO.FileMode.Open)

    ' Create a new XmlTextReader object with the FileStream.
    Dim xmlReader As New System.Xml.XmlTextReader(stream)

    ' Read the schema into the DataSet and close the reader.
    thisDataSet.ReadXmlSchema(xmlReader)
    xmlReader.Close()
End Sub

설명

메서드를 ReadXmlSchema 사용하여 에 대한 스키마를 만듭니다 DataSet. 스키마에는 테이블, 관계 및 제약 조건 정의가 포함됩니다.

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

Note

msdata:DataType 및 xs:type 형식이 일치하지 않는 경우 데이터 손상이 발생할 수 있습니다. 예외가 throw되지 않습니다.

ReadXmlSchema 이 메서드는 일반적으로 를 채우는 데 사용되는 메서드를 ReadXml 호출하기 전에 호출됩니다DataSet.

클래스는 System.Xml.XmlReader 추상입니다. 클래스에서 XmlReader 상속되는 클래스는 클래스입니다 System.Xml.XmlTextReader .

Note

사용자의 스키마에 DataSet 이름이 같지만 형식이 다른 요소가 동일한 네임스페이스에 있는 경우 스키마를 withReadXmlSchema로 읽으려고 할 때 예외가 DataSet throw됩니다. .NET Framework 버전 1.0을 사용하는 경우에는 이 예외가 발생하지 않습니다.

추가 정보

적용 대상