I want to fetch the element amount and its value from the below XML using XPath expression.
<donor>
<beneficiaries>
<beneficiary>
<balance>10</balance>
<additionaData>
<name>age</name>
<value>40</value>
</additionaData>
<additionaData>
<name>amount</name>
<value>1000</value>
</additionaData>
</beneficiary>
<beneficiary>
<balance>10</balance>
<additionaData>
<name>age</name>
<value>50</value>
</additionaData>
<additionaData>
<name>amount</name>
<value>4000</value>
</additionaData>
</beneficiary>
</beneficiaries>
</donor>
I am able to get the NodeList for beneficiary element but not able to get the content of tag name and value.
Update:
I want to first check if the tag <name> in <additionalData> is amount if yes fetch the content of <value> for all <beneficiary>.