XmlNode.ChildNodes プロパティ
アセンブリ: System.Xml (system.xml.dll 内)

ノードのすべての子ノードを格納している XmlNodeList。 子ノードがない場合、このプロパティは空の XmlNodeList を返します。

Option Strict Option Explicit Imports System Imports System.IO Imports System.Xml Public Class Sample Public Shared Sub Main() Dim doc As New XmlDocument() doc.LoadXml("<book ISBN='1-861001-57-5'>" & _ "<title>Pride And Prejudice</title>" & _ "<price>19.95</price>" & _ "</book>") Dim root As XmlNode = doc.FirstChild 'Display the contents of the child nodes. If root.HasChildNodes Then Dim i As Integer For i = 0 To root.ChildNodes.Count - 1 Console.WriteLine(root.ChildNodes(i).InnerText) Next i End If End Sub 'Main End Class 'Sample
using System; using System.IO; using System.Xml; public class Sample { public static void Main() { XmlDocument doc = new XmlDocument(); doc.LoadXml("<book ISBN='1-861001-57-5'>" + "<title>Pride And Prejudice</title>" + "<price>19.95</price>" + "</book>"); XmlNode root = doc.FirstChild; //Display the contents of the child nodes. if (root.HasChildNodes) { for (int i=0; i<root.ChildNodes.Count; i++) { Console.WriteLine(root.ChildNodes[i].InnerText); } } } }
#using <System.Xml.dll> using namespace System; using namespace System::IO; using namespace System::Xml; int main() { XmlDocument^ doc = gcnew XmlDocument; doc->LoadXml( "<book ISBN='1-861001-57-5'>" "<title>Pride And Prejudice</title>" "<price>19.95</price>" "</book>" ); XmlNode^ root = doc->FirstChild; //Display the contents of the child nodes. if ( root->HasChildNodes ) { for ( int i = 0; i < root->ChildNodes->Count; i++ ) { Console::WriteLine( root->ChildNodes[ i ]->InnerText ); } } }
import System.*; import System.IO.*; import System.Xml.*; public class Sample { public static void main(String[] args) { XmlDocument doc = new XmlDocument(); doc.LoadXml("<book ISBN='1-861001-57-5'>" + "<title>Pride And Prejudice</title>" + "<price>19.95</price>" + "</book>"); XmlNode root = doc.get_FirstChild(); //Display the contents of the child nodes. if (root.get_HasChildNodes()) { for (int i = 0; i < root.get_ChildNodes().get_Count(); i++) { Console.WriteLine(root.get_ChildNodes().Item(i).get_InnerText()); } } } //main } //Sample

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に収録されているすべての辞書からXmlNode.ChildNodes プロパティを検索する場合は、下記のリンクをクリックしてください。

- XmlNode.ChildNodes プロパティのページへのリンク