Represents elements in an XML tree that supports deferred streaming output.
using System; using System.Linq; using System.Xml.Linq; using System.Collections; using System.Collections.Generic; public class MainClass{ public static void Main(){ XElement srcTree = new XElement("Root", new XElement("Child", 1), new XElement("Child", 4), new XElement("Child", 5) ); XElement dstTree1 = new XElement("NewRoot", from el in srcTree.Elements() where (int)el >= 2 select new XElement("DifferentChild", (int)el) ); XStreamingElement dstTree2 = new XStreamingElement("NewRoot", from el in srcTree.Elements() where (int)el >= 2 select new XElement("DifferentChild", (int)el) ); Console.WriteLine(dstTree1); Console.WriteLine(dstTree2); } }
1. | Create an XML tree in a namespace. | ||
2. | Create an XML tree with nested namespaces. | ||
3. | Create an XML tree in a namespace | ||
4. | Create an XML tree in a namespace, with a specified prefix |