XStreamingElement represents elements in an XML tree that supports deferred streaming output. : XML Tree « XML « VB.Net






XStreamingElement represents elements in an XML tree that supports deferred streaming output.

 
Imports System
Imports System.Xml
Imports System.Xml.Schema

Class MainClass

    Shared Sub Main()

        Dim srcTree As XElement = _
                <Root>
                    <Child>1</Child>
                    <Child>2</Child>
                    <Child>3</Child>
                    <Child>4</Child>
                    <Child>5</Child>
                </Root>

        Dim dstTree1 As XElement = _
            <NewRoot>
                <%= From el In srcTree.Elements _
                    Where (el.Value >= 3) _
                    Select <DifferentChild><%= el.Value %></DifferentChild> %>
            </NewRoot>

        Dim dstTree2 As XStreamingElement = New XStreamingElement("NewRoot", _
                        From el In srcTree.Elements _
                        Where el.Value >= 3 _
                        Select <DifferentChild><%= el.Value %></DifferentChild> _
                    )

        Console.WriteLine(dstTree1)
        Console.WriteLine(dstTree2)
    End Sub
End Class

   
  








Related examples in the same category

1.Use Tree to Display XML document
2.Create an XML tree in a namespace
3.Create an XML tree with nested namespaces
4.Create an XML tree with nested namespaces