Get leaf nodes - XML parsing in Java

Viewed 4329

Is it possible to parse an XML and get all the leaf nodes ?

<root>
<emp>
<name>abc<name>
<age>12</age>
</emp>
<dept>
<branch>cse</branch>
</dept>
</root>

My output should be name age branch

3 Answers
Related