XmlReader.ReadInnerXml メソッド
アセンブリ: System.Xml (system.xml.dll 内)

Dim instance As XmlReader Dim returnValue As String returnValue = instance.ReadInnerXml
現在のノード内の、マークアップを含むすべての XML の内容。現在のノードが子を持っていない場合は、空の文字列が返されます。 現在のノードが要素でも属性でもない場合は、空の文字列が返されます。


このメソッドは、マークアップを含め、現在のノードの内容のすべてを返します。現在のノード (開始タグ) および対応する終了ノード (終了タグ) は返されません。たとえば、次の場合、
<node> this <child/> </node>
ReadInnerXml 返される結果は次のようになります。 this <child/>
このメソッドは、要素ノードおよび属性ノードを次の方法で処理します。
ノード型 | ||||
---|---|---|---|---|
<item1>text1</item1><item2>text2</item2> | text1 | |||
val1 |
リーダーをリーフ ノードに配置すると、ReadInnerXml の呼び出しは、Read の呼び出しに等しくなります。メソッドは String.Empty を返します (ただし、属性ノードの場合は属性の値を返します)。
このメソッドは、整形式の XML かどうかをチェックします。ReadInnerXml が XmlValidatingReader から呼び出された場合、返された内容も検証します。
ReadOuterXml メソッドは、XmlNodeReader クラス、XmlTextReader クラス、および XmlValidatingReader クラスで実装されるため、名前空間を認識します。

ReadInnerXml メソッドと ReadOuterXml メソッドを比較する例を次に示します。
' Load the file and ignore all white space. Dim settings As New XmlReaderSettings() settings.IgnoreWhitespace = True Using reader As XmlReader = XmlReader.Create("2books.xml") ' Moves the reader to the root element. reader.MoveToContent() ' Moves to book node. reader.Read() ' Note that ReadInnerXml only returns the markup of the node's children ' so the book's attributes are not returned. Console.WriteLine("Read the first book using ReadInnerXml...") Console.WriteLine(reader.ReadInnerXml()) ' ReadOuterXml returns the markup for the current node and its children ' so the book's attributes are also returned. Console.WriteLine("Read the second book using ReadOuterXml...") Console.WriteLine(reader.ReadOuterXml()) End Using
// Load the file and ignore all white space. XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreWhitespace = true; using (XmlReader reader = XmlReader.Create("2books.xml")) { // Moves the reader to the root element. reader.MoveToContent(); // Moves to book node. reader.Read(); // Note that ReadInnerXml only returns the markup of the node's children // so the book's attributes are not returned. Console.WriteLine("Read the first book using ReadInnerXml..."); Console.WriteLine(reader.ReadInnerXml()); // ReadOuterXml returns the markup for the current node and its children // so the book's attributes are also returned. Console.WriteLine("Read the second book using ReadOuterXml..."); Console.WriteLine(reader.ReadOuterXml()); }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からXmlReader.ReadInnerXml メソッドを検索する場合は、下記のリンクをクリックしてください。

- XmlReader.ReadInnerXml メソッドのページへのリンク