XNode.ElementsBeforeSelf returns a collection of the sibling elements before this node : XML Node « XML « VB.Net






XNode.ElementsBeforeSelf returns a collection of the sibling elements before this node

 
Imports System
Imports System.Xml
Imports System.Xml.Schema
Imports System.Linq
Imports System.Collections
Imports System.Collections.Generic
Class MainClass

    Shared Sub Main()

        Dim xmlTree As XElement = _
                <Root>Text content.
                    <Child1>child1 content</Child1>
                    <Child2>child2 content</Child2>
                    <Child3>child3 content</Child3>More text content.
                    <Child4>child4 content</Child4>
                    <Child5>child5 content</Child5>
                </Root>

        Dim child As XElement = xmlTree.<Child3>(0)
        Dim elements As IEnumerable(Of XElement) = child.ElementsBeforeSelf()

        For Each el In elements
            Console.WriteLine(el.Name)
        Next
    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.Select all the ancestor nodes of the title node
24.Extensions.Ancestors(T) returns a collection of elements that contains the ancestors of every node
25.Extensions.DescendantNodes(T)
26.Extensions.InDocumentOrder(T) returns a collection of nodes that contains all nodes in the source collection
27.Extensions.Nodes(T) Method returns a collection of the child nodes of every document and element
28.Extensions.Remove(T) removes every node in the source collection from its parent node.
29.Loop through the xml nodes
30.XNode.AddAfterSelf adds the specified content immediately after this node.
31.XNode.AddAfterSelf (Object[]) adds the specified content immediately after this node.
32.XNode.AddBeforeSelf (Object) adds the specified content immediately before this node.
33.XNode.AddBeforeSelf (Object[]) adds the specified content immediately before this node.
34.XNode.Ancestors returns a collection of the ancestor elements of this node.
35.XNode.Ancestors (XName) returns a filtered collection of the ancestor elements of this node
36.XNode.ElementsAfterSelf returns a collection of the sibling elements after this node, in document order.
37.XNode.ElementsAfterSelf (XName) returns a filtered collection of the sibling elements after 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.