Reputation: 18547
I wish to get all elements that contain attributes from namespace http://www.my.com/
The code:
IEnumerable<XElement> list1 =
from el in RootElement.DescendantsAndSelf()
//where it contains attributes from http://www.my.com/ - how?
select el;
Upvotes: 1
Views: 265
Reputation: 236318
Verify namespace part of attribute name:
XNamespace my = "http://www.my.com/";
IEnumerable<XElement> list1 =
from el in xdoc.Root.DescendantsAndSelf()
where el.Attributes().Any(attr => attr.Name.Namespace == my)
select el;
Upvotes: 2