XPathNavigator.LocalName Property gets Name of the current node without namespace prefix. : XPathNavigator « XML « VB.Net

XPathNavigator.LocalName Property gets Name of the current node without namespace prefix.


Imports System
Imports System.Xml
Imports System.Xml.XPath

Public Class MainClass

    Public Shared Sub Main()

        Dim document As XPathDocument = New XPathDocument("books.xml")
        Dim navigator As XPathNavigator = document.CreateNavigator()
        Dim nodeset As XPathNodeIterator = navigator.Select("descendant::book[author/last-name='Melville']")
        While nodeset.MoveNext()
        End While

    End Sub
    Shared Sub RecursiveWalk(ByVal navigator As XPathNavigator)
        Select Case navigator.NodeType
            Case XPathNodeType.Element
                If navigator.Prefix = String.Empty Then
                    Console.WriteLine("<{0}>", navigator.LocalName)
                    Console.Write("<{0}:{1}>", navigator.Prefix, navigator.LocalName)
                    Console.WriteLine(vbTab + navigator.NamespaceURI)
                End If
            Case XPathNodeType.Text
                Console.WriteLine(vbTab + navigator.Value)
        End Select
        If navigator.MoveToFirstChild() Then
            Loop While (navigator.MoveToNext())
            If (navigator.NodeType = XPathNodeType.Element) Then
                Console.WriteLine("</{0}>", navigator.Name)
            End If
            If navigator.NodeType = XPathNodeType.Element Then
                Console.WriteLine("</{0}>", navigator.Name)
            End If
        End If
    End Sub
End Class


Related examples in the same category

1.Creates an XPathNavigator for navigating this object.
2.XPathNavigator.AppendChild creates new child node
3.XPathNavigator.AppendChild Method (XPathNavigator) creates a new child node
4.XPathNavigator.AppendChildElement creates a new child element node
5.XPathNavigator.CanEdit Property
6.XPathNavigator.Clone Method creates a new XPathNavigator positioned at the same node as this XPathNavigator.
9.XPathNavigator.DeleteRange deletes a range of sibling nodes
10.XPathNavigator.DeleteSelf deletes the current node and its child nodes.
11.XPathNavigator.Evaluate dvaluates XPath expression and returns the typed result.
12.XPathNavigator.Evaluate (String, IXmlNamespaceResolver)
13.XPathNavigator.Evaluate (XPathExpression)
14.XPathNavigator.Evaluate (XPathExpression, XPathNodeIterator)
16.XPathNavigator.InsertAfter creates a new sibling node after the currently selected node.
17.Creates a new sibling node from XPathNavigator
19.XPathNavigator.InsertBefore (XPathNavigator)
21.XPathNavigator.InsertElementBefore Method
22.XPathNavigator.Matches determines whether the current node matches the specified XPathExpression.
25.Moves the XPathNavigator to the element with the local name and namespace URI specified, to the boundary
26.Moves the XPathNavigator to the following element
27.Moves the XPathNavigator to the following element of the XPathNodeType specified
28.Gets an IEqualityComparer used for equality comparison of XPathNavigator objects.
29.XPathNavigator.OuterXml Property
30.XPathNavigator.PrependChild creates child node at the beginning of child nodes
31.XPathNavigator.PrependChild (XPathNavigator)
32.XPathNavigator.PrependChildElement (System.Xml.XPath)
33.XPathNavigator.ReplaceRange (System.Xml.XPath) replaces a range of sibling nodes
34.XPathNavigator.ReplaceSelf (String) replaces the current node with the content of the string specified.
35.XPathNavigator.ReplaceSelf (XPathNavigator) replaces the current node
36.XPathNavigator.Select (String) selects a node set, using the specified XPath expression.
37.XPathNavigator.Select (String, IXmlNamespaceResolver)
38.XPathNavigator.Select (XPathExpression)
39.XPathNavigator.SelectAncestors selects all the ancestor nodes of the current node with local name and namespace URI.
40.XPathNavigator.SelectSingleNode selects a single node in the XPathNavigator using the specified XPath query.
41.XPathNavigator.SelectSingleNode selects a single node in the XPathNavigator
42.XPathNavigator.SelectSingleNode (XPathExpression)
43.XPathNavigator.SetTypedValue sets the typed value of the current node.
44.XPathNavigator.SetValue sets the value of the current node.
45.XPathNavigator.ValueAsBoolean gets the current node's value as a Boolean.
46.XPathNavigator.ValueType Property gets the .NET Framework Type of the current node.