Given The following XML:
<Root>
<NodeA>
<ChildNodeA/>
<ChildNodeB/>
</NodeA>
<NodeB>
<ChildNodeB/>
</NodeB>
<NodeC>
</NodeC>
</Root>
How do I find the first Preceding Siblilng of a particular Node that contains a particular Element.
I.E. If I am at “NodeC” how do I find the first Sibling with “ChildNodeA”, in this instance “NodeA”?
Thanks in advance.
To find the first preceding sibling that contains a child element is quite straight-forward, and indeed closely matches the way you describe it….
Assuming your were positioned on NodeC, this would indeed return your NodeA in your case