Select all the ancestor nodes of the title node : XML Node « XML « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net » XML » XML NodeScreenshots 
Select all the ancestor nodes of the title node
 
Imports System
Imports System.Xml
Imports System.Xml.XPath

Public Class MainClass

    Public Shared Sub Main()
        Dim document As XPathDocument = New XPathDocument("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("title""http://www.domain.com/books")
        
        Dim bookAncestors As XPathNodeIterator = navigator.SelectAncestors("""http://www.domain.com/books", False)
        
        While bookAncestors.MoveNext()
            Console.WriteLine(bookAncestors.Current.Name)
        End While
    End Sub
End Class

   
  
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.Gets all the child nodes of the node.
13.Creates a duplicate of this node.
14.Gets the first child of the node.
15.Gets the markup representing this node and all its child nodes.
16.Adds node to the beginning of the list of child nodes for this node.
17.Removes specified child node.
18.Replaces the child node oldChild with newChild node.
19.Selects a list of nodes matching the XPath expression.
20.Handles NodeChanged, NodeChanging, NodeInserted, NodeInserting, NodeRemoved and NodeRemoving events.
21.Calls MoveToContent and tests if the current content node is a start tag or empty element tag
22.Select all the child nodes of the book 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.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.