次の方法で共有


DataSet.ReadXmlSchema メソッド

XML スキーマを DataSet に読み込みます。

オーバーロードの一覧

指定した Stream から DataSet に XML スキーマを読み込みます。

[Visual Basic] Overloads Public Sub ReadXmlSchema(Stream)

[C#] public void ReadXmlSchema(Stream);

[C++] public: void ReadXmlSchema(Stream*);

[JScript] public function ReadXmlSchema(Stream);

指定したファイルから DataSet に XML スキーマを読み込みます。

.NET Compact Framework でもサポート。

[Visual Basic] Overloads Public Sub ReadXmlSchema(String)

[C#] public void ReadXmlSchema(string);

[C++] public: void ReadXmlSchema(String*);

[JScript] public function ReadXmlSchema(String);

指定した TextReader から DataSet に XML スキーマを読み込みます。

[Visual Basic] Overloads Public Sub ReadXmlSchema(TextReader)

[C#] public void ReadXmlSchema(TextReader);

[C++] public: void ReadXmlSchema(TextReader*);

[JScript] public function ReadXmlSchema(TextReader);

指定した XmlReader から DataSet に XML スキーマを読み込みます。

.NET Compact Framework でもサポート。

[Visual Basic] Overloads Public Sub ReadXmlSchema(XmlReader)

[C#] public void ReadXmlSchema(XmlReader);

[C++] public: void ReadXmlSchema(XmlReader*);

[JScript] public function ReadXmlSchema(XmlReader);

使用例

[Visual Basic, C#, C++] 新しい DataSet および System.IO.FileStream オブジェクトを作成する例を次に示します。ファイル パスとファイル名で作成した FileStream オブジェクトを使用して、引数として ReadXmlSchema メソッドに渡される System.Xml.XmlTextReader を作成します。

[Visual Basic, C#, C++] メモ   ここでは、ReadXmlSchema のオーバーロード形式のうちの 1 つだけについて、使用例を示します。その他の例については、各オーバーロード形式のトピックを参照してください。

 
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 = "mySchema.xml"
    ' Create a FileStream object with the file path and name.
    Dim myFileStream As New System.IO.FileStream _
       (filename, System.IO.FileMode.Open)
    ' Create a new XmlTextReader object with the FileStream.
    Dim myXmlTextReader As New System.Xml.XmlTextReader(myFileStream)
    ' Read the schema into the DataSet and close the reader.
    thisDataSet.ReadXmlSchema(myXmlTextReader)
    myXmlTextReader.Close()
End Sub

[C#] 
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="mySchema.xml";
   // Create a FileStream object with the file path and name.
   System.IO.FileStream myFileStream = new System.IO.FileStream
      (filename,System.IO.FileMode.Open);
   // Create a new XmlTextReader object with the FileStream.
   System.Xml.XmlTextReader myXmlTextReader= 
      new System.Xml.XmlTextReader(myFileStream);
   // Read the schema into the DataSet and close the reader.
   thisDataSet.ReadXmlSchema(myXmlTextReader);
   myXmlTextReader.Close();
}

[C++] 
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=S"mySchema.xml";
    // Create a FileStream object with the file path and name.
    System::IO::FileStream* myFileStream = new System::IO::FileStream
       (filename,System::IO::FileMode::Open);
    // Create a new XmlTextReader object with the FileStream.
    System::Xml::XmlTextReader* myXmlTextReader= 
       new System::Xml::XmlTextReader(myFileStream);
    // Read the schema into the DataSet and close the reader.
    thisDataSet->ReadXmlSchema(myXmlTextReader);
    myXmlTextReader->Close();
 }

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

参照

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