指定したファイルから DataSet に XML スキーマを読み込みます。
Overloads Public Sub ReadXmlSchema( _
ByVal fileName As String _)
[C#]
public void ReadXmlSchema(stringfileName);
[C++]
public: void ReadXmlSchema(String* fileName);
[JScript]
public function ReadXmlSchema(
fileName : String);
パラメータ
- fileName
読み込み元の (パスを含む) ファイル名。
例外
例外の種類 | 条件 |
---|---|
SecurityException | FileIOPermission が Read に設定されていません。 |
解説
ReadXmlSchema メソッドを使用して、 DataSet のスキーマを作成します。スキーマにはテーブル、リレーションシップ、制約の各定義が含まれています。XML ドキュメントにスキーマを書き込むには、 WriteXmlSchema メソッドを使用します。
XML スキーマの書き込みには、XSD 標準を使用します。
通常、 ReadXmlSchema メソッドは、 DataSet への格納に使用する ReadXml メソッドの呼び出しの前に呼び出されます。
メモ DataSet のスキーマに、同じ名前空間で名前が同じであるが型が違う要素が含まれている場合、スキーマを ReadXmlSchema で DataSet に読み込もうとすると、例外がスローされます。この例外は、.NET Framework Version 1.0 を使用している場合は発生しません。
使用例
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 = "mySchema.xml"
' Invoke the ReadXmlSchema method with the file name.
thisDataSet.ReadXmlSchema(filename)
End Sub
[C#]
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="mySchema.xml";
// Invoke the ReadXmlSchema method with the file name.
thisDataSet.ReadXmlSchema(filename);
}
[C++]
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=S"mySchema.xml";
// Invoke the ReadXmlSchema method with the file name.
thisDataSet->ReadXmlSchema(filename);
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
.NET Framework セキュリティ:
- FileIOPermission (ファイルの読み書き用) FileIOPermissionAccess (関連する列挙体)
参照
DataSet クラス | DataSet メンバ | System.Data 名前空間 | DataSet.ReadXmlSchema オーバーロードの一覧 | ReadXml | WriteXml | WriteXmlSchema