How to find node if parent node and child node have the same name?

I am working on a project in which I have to work with XML files using java. I used to get nodes using the name node, i.e. getElementsByTagName(). Now the problem arises when I have an xml file with a parent node and a child node with the same name.
How can I distinguish between them.

This is a short sample of my xml file.

 <deviceparameters>
     <parameter>   // parent
        <name>ABC</name> 
        <parameter>Yes</parameter> // child with same name
        <value>20</value> 
     </parameter>
 </deviceparameters>

Thanks in advance.

+3
source share
1 answer

deviceparameters , parameter, , parameter . Javadoc (, ).

+2

All Articles