XElement with namespace
using System;
using System.Linq;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass{
public static void Main(){
XNamespace aw = "http://www.domain.com";
XElement xmlTree1 = new XElement(aw + "Root",
new XElement(aw + "Child1", 1),
new XElement(aw + "Child5", 5),
new XElement(aw + "Child6", 6)
);
XElement xmlTree2 = new XElement(aw + "Root",
from el in xmlTree1.Elements()
where((int)el >= 3 && (int)el <= 5)
select el
);
Console.WriteLine(xmlTree2);
}
}
Related examples in the same category