DataSet.ReadXmlSchema メソッド (String)
アセンブリ: System.Data (system.data.dll 内)



ReadXmlSchema メソッドを使用して、DataSet のスキーマを作成します。スキーマにはテーブル、リレーションシップ、制約の各定義が含まれています。XML ドキュメントにスキーマを書き込むには、WriteXmlSchema メソッドを使用します。
通常、ReadXmlSchema メソッドは、DataSet への格納に使用する ReadXml メソッドの呼び出しの前に呼び出されます。
![]() |
---|
DataSet のスキーマに、同じ名前空間で名前が同じであるが型が違う要素が含まれている場合、スキーマを ReadXmlSchema で DataSet に読み込もうとすると、例外がスローされます。この例外は、.NET Framework Version 1.0 を使用している場合は発生しません。 |
Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows CE プラットフォームメモ : file:// URI 方式を使用する場合、相対パスはサポートされません。絶対パス情報を指定してください。

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


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DataSet.ReadXmlSchema メソッド (Stream)
アセンブリ: System.Data (system.data.dll 内)


ReadXmlSchema メソッドを使用して、DataSet のスキーマを作成します。スキーマにはテーブル、リレーションシップ、制約の各定義が含まれています。XML ドキュメントにスキーマを書き込むには、WriteXmlSchema メソッドを使用します。
通常、ReadXmlSchema メソッドは、DataSet への格納に使用する ReadXml メソッドの呼び出しの前に呼び出されます。
Stream クラスの派生クラスには、BufferedStream、FileStream、MemoryStream、および NetworkStream が含まれます。
![]() |
---|
DataSet のスキーマに、同じ名前空間で名前が同じであるが型が違う要素が含まれている場合、スキーマを ReadXmlSchema で DataSet に読み込もうとすると、例外がスローされます。この例外は、.NET Framework Version 1.0 を使用している場合は発生しません。 |

XML スキーマの読み込みに使用する FileStream オブジェクトを作成し、このオブジェクトで ReadXmlSchema メソッドを呼び出す例を次に示します。
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
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(); }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DataSet.ReadXmlSchema メソッド (TextReader)
アセンブリ: System.Data (system.data.dll 内)


ReadXmlSchema メソッドを使用して、DataSet のスキーマを作成します。スキーマにはテーブル、リレーションシップ、制約の各定義が含まれています。XML ドキュメントにスキーマを書き込むには、WriteXmlSchema メソッドを使用します。
通常、ReadXmlSchema メソッドは、DataSet への格納に使用する ReadXml メソッドの呼び出しの前に呼び出されます。
TextReader クラスから継承するクラスには、StreamReader クラスと StringReader クラスが含まれます。
![]() |
---|
DataSet のスキーマに、同じ名前空間で名前が同じであるが型が違う要素が含まれている場合、スキーマを ReadXmlSchema で DataSet に読み込もうとすると、例外がスローされます。この例外は、.NET Framework Version 1.0 を使用している場合は発生しません。 |

スキーマの読み込みに使用する StreamReader オブジェクトを作成し、このオブジェクトで ReadXmlSchema メソッドを呼び出す例を次に示します。
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
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(); }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DataSet.ReadXmlSchema メソッド (XmlReader)
アセンブリ: System.Data (system.data.dll 内)


ReadXmlSchema メソッドを使用して、DataSet のスキーマを作成します。スキーマにはテーブル、リレーションシップ、制約の各定義が含まれています。
通常、ReadXmlSchema メソッドは、DataSet への格納に使用する ReadXml メソッドの呼び出しの前に呼び出されます。
System.Xml.XmlReader クラスは抽象クラスです。XmlReader から継承するクラスは System.Xml.XmlTextReader クラスです。
![]() |
---|
DataSet のスキーマに、同じ名前空間で名前が同じであるが型が違う要素が含まれている場合、スキーマを ReadXmlSchema で DataSet に読み込もうとすると、例外がスローされます。この例外は、.NET Framework Version 1.0 を使用している場合は発生しません。 |

新しい DataSet および System.IO.FileStream オブジェクトを作成する例を次に示します。ファイル パスとファイル名で作成した FileStream オブジェクトを使用して、引数として ReadXmlSchema メソッドに渡される System.Xml.XmlTextReader を作成します。
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
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(); }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DataSet.ReadXmlSchema メソッド

名前 | 説明 |
---|---|
DataSet.ReadXmlSchema (Stream) | 指定した Stream から DataSet に XML スキーマを読み込みます。 .NET Compact Framework によってサポートされています。 |
DataSet.ReadXmlSchema (String) | 指定したファイルから DataSet に XML スキーマを読み込みます。 .NET Compact Framework によってサポートされています。 |
DataSet.ReadXmlSchema (TextReader) | 指定した TextReader から DataSet に XML スキーマを読み込みます。 .NET Compact Framework によってサポートされています。 |
DataSet.ReadXmlSchema (XmlReader) | 指定した XmlReader から DataSet に XML スキーマを読み込みます。 .NET Compact Framework によってサポートされています。 |
