I need the first node of a complex xml by a deep deep subnode with random nodes between.
My XML:
<abc>
<bcd id="1">
<cde>
<bcd id="100">
<cde>
<xxx id="998">
</xxx>
</cde>
</bcd>
</cde>
</bcd>
<bcd id="2">
<cde>
<bcd id="101">
<cde>
<bcd id="102">
<cde>
<xxx id="999">
</xxx>
</cde>
</bcd>
</cde>
</bcd>
</cde>
</bcd>
</abc>
With this XPATH I get only with this design a correct result. the grade of nested is variabel.
"//bcd/cde/bcd/cde/xxx[@id='998']"
I want a XPATH like that where I get the first bcd (id=’1′) node:
"//[bcd/cde]+/xxx[@id='998']"
or first bcd (id=’2′) node:
"//[bcd/cde]+/xxx[@id='999']"
regards Chris
The following xpath works for me: