Mega Code Archive

 
Categories / VB.Net / XML
 

XNode ElementsAfterSelf returns a collection of the sibling elements after this node, in document order

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.ElementsAfterSelf()         For Each el In elements             Console.WriteLine(el.Name)         Next     End Sub End Class