Gets all the child nodes of the node. : XML Node « XML « VB.Net






Gets all the child nodes of the node.

 

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-111111-57-5'>" & _
                    "<title>C#</title>" & _
                    "<price>9.9</price>" & _
                    "</book>")

        Dim root As XmlNode = doc.FirstChild

        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

   
  








Related examples in the same category

1.Creates an XmlSignificantWhitespace node.
2.Gets the node containing the DOCTYPE declaration.
3.Imports a node from another document to the current document.
4.Gets a value indicating whether the current node is read-only.
5.Creates a duplicate of this node.
6.Gets or sets the concatenated values of the node and all its children.
7.Gets the local name of the current node.
8.Gets the qualified name of the node.
9.Gets the node immediately following this node.
10.Gets the node immediately preceding this node.
11.Adds node to the end of the list of child nodes
12.Creates a duplicate of this node.
13.Gets the first child of the node.
14.Gets the markup representing this node and all its child nodes.
15.Adds node to the beginning of the list of child nodes for this node.
16.Removes specified child node.
17.Replaces the child node oldChild with newChild node.
18.Selects a list of nodes matching the XPath expression.
19.Handles NodeChanged, NodeChanging, NodeInserted, NodeInserting, NodeRemoved and NodeRemoving events.
20.Calls MoveToContent and tests if the current content node is a start tag or empty element tag
21.Select all the child nodes of the book node
22.Select all the ancestor nodes of the title node
23.Extensions.Ancestors(T) returns a collection of elements that contains the ancestors of every node
24.Extensions.DescendantNodes(T)
25.Extensions.InDocumentOrder(T) returns a collection of nodes that contains all nodes in the source collection
26.Extensions.Nodes(T) Method returns a collection of the child nodes of every document and element
27.Extensions.Remove(T) removes every node in the source collection from its parent node.
28.Loop through the xml nodes
29.XNode.AddAfterSelf adds the specified content immediately after this node.
30.XNode.AddAfterSelf (Object[]) adds the specified content immediately after this node.
31.XNode.AddBeforeSelf (Object) adds the specified content immediately before this node.
32.XNode.AddBeforeSelf (Object[]) adds the specified content immediately before this node.
33.XNode.Ancestors returns a collection of the ancestor elements of this node.
34.XNode.Ancestors (XName) returns a filtered collection of the ancestor elements of this node
35.XNode.ElementsAfterSelf returns a collection of the sibling elements after this node, in document order.
36.XNode.ElementsAfterSelf (XName) returns a filtered collection of the sibling elements after this node
37.XNode.ElementsBeforeSelf returns a collection of the sibling elements before this node
38.XNode.ElementsBeforeSelf returns a filtered collection of the sibling elements before this node
39.XNode.IsAfter determines if the current node appears after a specified node
40.XNode.IsBefore determines if the current node appears before a specified node
41.XNode.NextNode Property gets the next sibling node of this node.
42.XNode.NodesAfterSelf returns a collection of the sibling nodes after this node
43.XNode.NodesBeforeSelf returns a collection of the sibling nodes before this node
44.XNode.PreviousNode Property gets the previous sibling node of this node.
45.XNode.Remove removes this node from its parent.
46.XNode.ReplaceWith replaces this node with the specified content.
47.XNode.ReplaceWith replaces this node with the specified content.
48.XNode.ToString returns the XML for this node, optionally disabling formatting.
49.XNode.ToString returns the indented XML for this node.
50.XObject.NodeType Property gets the node type for this XObject.