I have a sample XML (Android platform) and I wanted to know the easiest and most efficient approach to get the node value of the node “e”. Please help.
<a>
<b>
<c>
<e>data</e>
</c>
</b>
<b>
</b>
</a>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use XPath.
See – http://developer.android.com/reference/javax/xml/xpath/package-summary.html
The XPath expression to grab the correct element would be:
You could coalesce the resulting node into a
Stringto get the textual value.