XmlDataDocument.DataSet プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > XmlDataDocument.DataSet プロパティの意味・解説 

XmlDataDocument.DataSet プロパティ

XmlDataDocumentデータのリレーショナル表現提供する DataSet取得します

名前空間: System.Xml
アセンブリ: System.Data (system.data.dll 内)
構文構文

解説解説
使用例使用例

DataSet メソッド使用して書籍価格変更する例を次に示します

imports System
imports System.Data
imports System.Xml

public class Sample

  public shared sub Main()

    'Create an XmlDataDocument.
    Dim doc as XmlDataDocument = new
 XmlDataDocument()

    'Load the schema.
    doc.DataSet.ReadXmlSchema("store.xsd") 
 
    'Load the XML data.
    doc.Load("2books.xml")

    'Change the price on the first book using the DataSet methods.
    Dim books as DataTable = doc.DataSet.Tables.Item("book")
    books.Rows.Item(0).Item("price") = "12.95"
 

    Console.WriteLine("Display the modified XML data...")
    doc.Save(Console.Out)

  end sub
end class
using System;
using System.Data;
using System.Xml;

public class Sample
{
  public static void Main()
  {
     //Create an XmlDataDocument.
     XmlDataDocument doc = new XmlDataDocument();

     //Load the schema file.
     doc.DataSet.ReadXmlSchema("store.xsd"); 

     //Load the XML data.
     doc.Load("2books.xml");

     //Update the price on the first book using the DataSet methods.
     DataTable books = doc.DataSet.Tables["book"];
     books.Rows[0]["price"] = "12.95";  

     Console.WriteLine("Display the modified XML data...");
     doc.Save(Console.Out);
  }
} // End class
#using <System.dll>
#using <System.Xml.dll>
#using <System.Data.dll>

using namespace System;
using namespace System::Data;
using namespace System::Xml;

int main()
{
   
   //Create an XmlDataDocument.
   XmlDataDocument^ doc = gcnew XmlDataDocument;
   
   //Load the schema file.
   doc->DataSet->ReadXmlSchema( "store.xsd" );
   
   //Load the XML data.
   doc->Load( "2books.xml" );
   
   //Update the price on the first book using the DataSet methods.
   DataTable^ books = doc->DataSet->Tables[ "book" ];
   books->Rows[ 0 ][ "price" ] = "12.95";
   Console::WriteLine( "Display the modified XML data..." );
   doc->Save( Console::Out );
}
import System.*;
import System.Data.*;
import System.Xml.*;

public class Sample
{
    public static void main(String[]
 args)
    {
        //Create an XmlDataDocument.
        XmlDataDocument doc = new XmlDataDocument();

        //Load the schema file.
        doc.get_DataSet().ReadXmlSchema("store.xsd");

        //Load the XML data.
        doc.Load("2books.xml");

        //Update the price on the first book using the DataSet methods.
        DataTable books = doc.get_DataSet().get_Tables().get_Item("book");
        books.get_Rows().get_Item(0).set_Item("price", "12.95");

        Console.WriteLine("Display the modified XML data...");
        doc.Save(Console.get_Out());
    } //main
} //Sample // End class

この例では、次の 2 つファイル入力として使用してます。

2books.xml

<!--sample XML fragment-->
<bookstore>
  <book genre='novel' ISBN='10-861003-324'>
    <title>The Handmaid's
 Tale</title>
    <price>19.95</price>
  </book>
  <book genre='novel' ISBN='1-861001-57-5'>
    <title>Pride
 And Prejudice</title>
    <price>24.95</price>
  </book>
</bookstore>

store.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

 <xsd:element name="bookstore"
 type="bookstoreType"/>

 <xsd:complexType name="bookstoreType">
  <xsd:sequence maxOccurs="unbounded">
   <xsd:element name="book"
  type="bookType"/>
  </xsd:sequence>
 </xsd:complexType>

 <xsd:complexType name="bookType">
  <xsd:sequence>
   <xsd:element name="title"
 type="xsd:string"/>
   <xsd:element name="author"
 type="authorName"/>
   <xsd:element name="price"
  type="xsd:decimal"/>
  </xsd:sequence>
  <xsd:attribute name="genre"
 type="xsd:string"/>
 </xsd:complexType>

 <xsd:complexType name="authorName">
  <xsd:sequence>
   <xsd:element name="first-name"
  type="xsd:string"/>
   <xsd:element name="last-name"
 type="xsd:string"/>
  </xsd:sequence>
 </xsd:complexType>

</xsd:schema>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
XmlDataDocument クラス
XmlDataDocument メンバ
System.Xml 名前空間
DataSet
DataTable


このページでは「.NET Framework クラス ライブラリ リファレンス」からXmlDataDocument.DataSet プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からXmlDataDocument.DataSet プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からXmlDataDocument.DataSet プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

XmlDataDocument.DataSet プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



XmlDataDocument.DataSet プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS