For an XDocument descendant operation, can only immediate child nodes be returned?
I have a row operation:
XDocument xmlDc = XDocument.Load(dependencyFilePath); IEnumerable<IGrouping<string, XElement>> scriptNodes = from s in xmlDc.Descendants("script") select s;
The problem is that my XML document is structured as follows
<topNode> <script> <someNode>...</someNode> <script>....</script> </script> </topNode>
Essentially, script tags can have tags for children, but when I do Descendents, I only want to get the children of the node, not the grandson of the script.
Is this possible with XDocument? Can I use the predicate to somehow check if the potential breeder has a parent node that I check to accomplish this?
c # linq-to-xml
Matt
source share