title: How to find a node if parent node and child node has same name?
body: <p>I am working on a project in which I have to operate XML files using java. 
  Earlier I was getting nodes by using node name, ie. <code>getElementsByTagName()</code>. Now a problem arises when I have an xml file with parent node and child node with same name.<br>
  How can I distinguish between them.</p>
  
  <p>This a short sample of my xml file.</p>
  
  <pre><code> &lt;deviceparameters&gt;
       &lt;parameter&gt;   // parent
          &lt;name&gt;ABC&lt;/name&gt; 
          &lt;parameter&gt;Yes&lt;/parameter&gt; // child with same name
          &lt;value&gt;20&lt;/value&gt; 
       &lt;/parameter&gt;
   &lt;/deviceparameters&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>