title: Find elements in a Node without the proper namespace, in Java
body: <p>So I have a xml doc that I've declared here:</p>
  
  <pre><code>DocumentBuilder dBuilder = dbFactory_.newDocumentBuilder();
  StringReader reader = new StringReader(s);
  InputSource inputSource = new InputSource(reader);
  doc_ = dBuilder.parse(inputSource);
  </code></pre>
  
  <p>Then I have a function where I pass in a string and I want to match that to an element in my xml:</p>
  
  <pre><code>void foo(String str)
  {
    NodeList nodelist = doc_.getDocumentElement().getElementsByTagName(str);
  }
  </code></pre>
  
  <p>The problem is when the <code>str</code> comes in it doesn't have any sort of namespace in it so the xml that I would be testing would be:</p>
  
  <pre><code>&lt;Random&gt;
    &lt;tns:node /&gt;
  &lt;/Random&gt;
  </code></pre>
  
  <p>and the <code>str</code> will be node.  So nodelist is now null because its expecting tns:node but I passed in node.  And I know its not good to ignore the namespace but in this instance its fine.  My problem is that I don't know how to search the Node for an element while ignoring the namespace.  I also thought about adding the namespace to the str that comes in but I have no idea how to do that either.</p>
  
  <p>Any help would be greatly appreciated,  </p>
  
  <p>Thanks, -Josh</p>