XPath select specific child elements

Posted by Cool on Stack Overflow See other posts from Stack Overflow or by Cool
Published on 2010-03-31T23:34:38Z Indexed on 2010/03/31 23:43 UTC
Read the original article Hit count: 162

Filed under:
|

Hi, If I have XML tree like this-

<Parent>
 <Image Name="a"/>
 <Image Name="b"/>
 <Child>
  <Image Name="c"/>
  <Image Name="d"/>
 </Child>
 <Image Name="e"/>
</Parent>

I want to select all <Image\> nodes except those listed inside <Child\> node. Currently I am using query to select all Image nodes, -

xElement.XPathSelectElements("//ns:Image", namespace);

Thanks in advance.

© Stack Overflow or respective owner

Related posts about xpath

Related posts about c#