title: Unable to read xml with namespace prefix using DOM parser
body: <p>This is the input XML:</p>
  
  <pre><code>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;SOAP-ENV:Header/&gt;
     &lt;SOAP-ENV:Body&gt;
        &lt;ns2:SendResponse xmlns:ns2="http://mycompany.com/schema/"&gt;
           &lt;ns2:SendResult&gt;
              &lt;ns2:Token&gt;A00179-02&lt;/ns2:Token&gt;
           &lt;/ns2:SendResult&gt;
        &lt;/ns2:SendResponse&gt;
     &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>This the code that I'm using to read the XML (Variable xmlString contains the XML above):</p>
  
  <pre><code>DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  dbf.setNamespaceAware(true);
  DocumentBuilder db = dbf.newDocumentBuilder();
  InputSource is = new InputSource();
  is.setCharacterStream(new StringReader(xmlString));
  Document doc = db.parse(is);
  
  System.out.println("Element :" + doc.getElementsByTagName("Token").item(0));
  System.out.println("Element :" + doc.getElementsByTagName("ns2:Token").item(0));
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Element :null
  Element :[ns2:Token: null]
  </code></pre>
  
  <p>I'm able to read the element if I use "ns2:Token" as the tag name, but I don't want to use the prefix in my code as I'm not sure if it'll be the same or change in the future.  Is there any way to read the xml element without hard-coding the namespace in the tag name?</p>