DataSet.ReadXmlSchema 메서드

정의

XML 스키마를 DataSet으로 읽어옵니다.

오버로드

ReadXmlSchema(Stream)

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

ReadXmlSchema(TextReader)

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

ReadXmlSchema(String)

지정된 파일에서 DataSet으로 XML 스키마를 읽어옵니다.

ReadXmlSchema(XmlReader)

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

ReadXmlSchema(Stream)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

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

public:
 void ReadXmlSchema(System::IO::Stream ^ stream);
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입니다.

예제

다음 예제에서는 를 사용하여 FileStream XML 스키마를 읽을 개체를 만들고 개체를 사용하여 메서드를 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 표준을 사용하여 작성됩니다.

참고

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

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

클래스에서 Stream 파생되는 클래스에는 , FileStream, MemoryStreamNetworkStream가 포함됩니다BufferedStream.

참고

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

추가 정보

적용 대상

ReadXmlSchema(TextReader)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

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

public:
 void ReadXmlSchema(System::IO::TextReader ^ reader);
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 표준을 사용하여 작성됩니다.

참고

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

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

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

참고

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

추가 정보

적용 대상

ReadXmlSchema(String)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

지정된 파일에서 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

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

예외

FileIOPermissionRead로 설정되지 않은 경우

예제

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 표준을 사용하여 작성됩니다.

참고

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

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

참고

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

추가 정보

적용 대상

ReadXmlSchema(XmlReader)

Source:
DataSet.cs
Source:
DataSet.cs
Source:
DataSet.cs

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

public:
 void ReadXmlSchema(System::Xml::XmlReader ^ reader);
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입니다.

예제

다음 예제에서는 새 DataSetSystem.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 표준을 사용하여 작성됩니다.

참고

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

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

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

참고

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

추가 정보

적용 대상