Creates a new sibling node from XPathNavigator : XPathNavigator « XML « VB.Net






Creates a new sibling node from XPathNavigator

 

Imports System
Imports System.Xml
Imports System.Xml.XPath
Imports System.IO
Public Class MainClass

    Public Shared Sub Main()
        Dim document As XmlDocument = New XmlDocument()
        document.Load("domainBooks.xml")
        Dim navigator As XPathNavigator = document.CreateNavigator()
        
        navigator.MoveToChild("bookstore", "http://www.domain.com/books")
        navigator.MoveToChild("book", "http://www.domain.com/books")
        navigator.MoveToChild("price", "http://www.domain.com/books")
        
        Dim childNodes As XmlDocument = New XmlDocument()
        childNodes.Load(New StringReader("<pages xmlns='http://www.domain.com/books'>100</pages>"))
        Dim childNodesNavigator As XPathNavigator = childNodes.CreateNavigator()
        
        navigator.InsertAfter(childNodesNavigator)
        
        navigator.MoveToParent()
        Console.WriteLine(navigator.OuterXml)
    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.
7.XPathNavigator.CreateAttribute
8.XPathNavigator.CreateAttributes
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)
15.XPathNavigator.InsertAfter
16.XPathNavigator.InsertAfter creates a new sibling node after the currently selected node.
17.XPathNavigator.InsertBefore
18.XPathNavigator.InsertBefore (XPathNavigator)
19.XPathNavigator.InsertElementAfter
20.XPathNavigator.InsertElementBefore Method
21.XPathNavigator.LocalName Property gets Name of the current node without namespace prefix.
22.XPathNavigator.Matches determines whether the current node matches the specified XPathExpression.
23.XPathNavigator.MoveToFirstAttribute
24.XPathNavigator.MoveToFollowing
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.
47.XPathNavigator.WriteSubtree