title: Java code using Xerces's getElementsByTagName does not return child node
body: <p>I'm using Xerces parser in trying to parse the following XML snippet. I can find the "location-info" element by when I use the findElementsByTagName method to find Circle, I am getting an empty NodeList back. Can someone please spot check and see what I am doing wrong?</p>
  
  <pre><code>&lt;urn:locationResponse xmlns:urn="urn:ietf:params:xml:ns:geopriv:held"&gt;
  &lt;presence entity="pres:www.telecomsys.com" xmlns="urn:ietf:params:xml:ns:pidf"
            xmlns:gp="urn:ietf:params:xml:ns:pidf:geopriv10" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model"
            xmlns:gs="http://www.opengis.net/pidflo/1.0" xmlns:ca="urn:ietf:params:xml:ns:pidf:geopriv10:civicAddr"
            xmlns:gml="http://www.opengis.net/gml"&gt;
      &lt;tuple id="FIRST_LOCATION"&gt;
          &lt;status&gt;
              &lt;gp:geopriv&gt;
                  &lt;location-info xmlns="urn:ietf:params:xml:ns:pidf:geopriv10"&gt;
                      &lt;gs:Circle srsName="urn:ogc:def:crs:EPSG::4326"&gt;
                          &lt;gml:pos&gt;00.000000 -00.00000&lt;/gml:pos&gt;
                          &lt;gs:radius uom="urn:ogc:def:uom:EPSG::9001"&gt;200&lt;/gs:radius&gt;
                      &lt;/gs:Circle&gt;
                      &lt;gp:confidence&gt;95&lt;/gp:confidence&gt;
                  &lt;/location-info&gt;
                  &lt;gp:usage-rules&gt;
                      &lt;gp:retransmission-allowed&gt;yes&lt;/gp:retransmission-allowed&gt;
                  &lt;/gp:usage-rules&gt;
                  &lt;gp:method&gt;Derived&lt;/gp:method&gt;
              &lt;/gp:geopriv&gt;
          &lt;/status&gt;
          &lt;timestamp&gt;2001-01-00T00:00Z&lt;/timestamp&gt;
      &lt;/tuple&gt;
  &lt;/presence&gt;
  </code></pre>
  
  <p></p>
  
  <p>Following is my code which attempts to get the "Circle" tag out of this XML</p>
  
  <pre><code>    private static final Log logger = LogFactory.getLog(PIDFLOParser.class);
      private static final String LOCATION_INFO = "location-info";
      private static final String CIRCLE = "Circle";
  
      // Use of the Document BuilderFactory to create a DocumentBuilder class.
      DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
      DocumentBuilder builder = fact.newDocumentBuilder();
  
      Document doc = builder.parse(new InputSource(new StringReader(xmlDoc)));
      doc.getDocumentElement().normalize();
  
      Node node = doc.getDocumentElement();
  
      String root = node.getNodeName();
      System.out.println("Root Node: " + root);
  
      NodeList listResponse = doc.getElementsByTagName(LOCATION_INFO);
      if (listResponse.getLength() == 0) {
          System.out.println(String.format("%s doesn't exist in the Document.", LOCATION_INFO));
      }
  
      Node firstNode = listResponse.item(0);
      listResponse = ((Element) firstNode).getElementsByTagName(CIRCLE);
      if (listResponse.getLength() == 0) {
          System.out.println(String.format("%s doesn't exist in the Document.", CIRCLE));
      }
  
      listResponse = ((Element) firstNode).getElementsByTagNameNS("gs", CIRCLE);
      if (listResponse.getLength() == 0) {
          System.out.println(String.format("%s doesn't exist in the Document when searching with namespace.", CIRCLE));
      }
  </code></pre>
  
  <p>Output of this code is:</p>
  
  <pre><code>    Root Node: urn:locationResponse
  Circle doesn't exist in the Document.
  Circle doesn't exist in the Document when searching with namespace.
  </code></pre>
  
  <p>What am I doing wrong? Thanks in advance for help!</p>
  
  <p><strong>Updated after guido's comment about full URI of namespace</strong></p>
  
  <pre><code>...
      private static final String NS_GS = "http://www.opengis.net/pidflo/1.0";
  ...
      listResponse = ((Element) firstNode).getElementsByTagNameNS(NS_GS, CIRCLE);
      if (listResponse.getLength() == 0) {
          System.out.println(String.format("%s doesn't exist in the Document when searching with namespace.", CIRCLE));
      }
  </code></pre>
  
  <p>Output is still the same:</p>
  
  <pre><code>Root Node: urn:locationResponse
  Circle doesn't exist in the Document.
  Circle doesn't exist in the Document when searching with namespace.
  </code></pre>