xml - XPath to get node name based on existence of child node -
i have following nodes:
<resource> <datafield1> <label>...</label> <alert>...</alert> </datafield1> <datafield2> <label>...</label> </datafield2> <datafield3> <label>...</label> <alert>...</alert> </datafield3> </resource>
and show name of 1st , 3rd node because exists child node "alert".
datafield1 datafield3
with following xpath can show nodes:
//resource/*[alert]
result:
<datafield1> <label>...</label> <alert>...</alert> </datafield1> <datafield3> <label>...</label> <alert>...</alert> </datafield3>
but not want.
you need add label
:
//resource/*[alert]/label
Comments
Post a Comment