XPathNavigator.PrependChild creates child node at the beginning of child nodes : XPathNavigator « XML « VB.Net






XPathNavigator.PrependChild creates child node at the beginning of child nodes

 

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

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.PrependChild("<pages>100</pages>")
        
        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.Creates a new sibling node from XPathNavigator
18.XPathNavigator.InsertBefore
19.XPathNavigator.InsertBefore (XPathNavigator)
20.XPathNavigator.InsertElementAfter
21.XPathNavigator.InsertElementBefore Method
22.XPathNavigator.LocalName Property gets Name of the current node without namespace prefix.
23.XPathNavigator.Matches determines whether the current node matches the specified XPathExpression.
24.XPathNavigator.MoveToFirstAttribute
25.XPathNavigator.MoveToFollowing
26.Moves the XPathNavigator to the element with the local name and namespace URI specified, to the boundary
27.Moves the XPathNavigator to the following element
28.Moves the XPathNavigator to the following element of the XPathNodeType specified
29.Gets an IEqualityComparer used for equality comparison of XPathNavigator objects.
30.XPathNavigator.OuterXml Property
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