I have following XML :
<root>
<Type1 name="">
<Type2 name="">
<Type3 name="">
<finalType name="">
<element value=""/>
</finalType>
</Type3>
</Type2>
</Type1>
</root>
I would like to reach the value of element in the <finalType>
, usually I write :
echo //root/Type1/Type2/Type3/finalType /element@ xmllint etc...
BUT in my application the finalType can be in Type1 or Type2 ! ,so I'm looking for something like that
echo //root/***/finalType /element@ xmllint etc...
but unfortunately it doesnt work .. Do you have any idea How to "skip" the Type1 , Type2 ... ?
Just use the double slash (or descendant::
):
echo ls /root//element | xmllint --shell file.xml
echo ls /root/descendant::element | xmllint --shell file.xml