Parsing XML With Java Trying To Get Attribute On Namespace Childnode
<p>Here is my XML</p>

<pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Pport xmlns="http://www.thalesgroup.com/rtti/PushPort/v12" xmlns:ns3="http://www.thalesgroup.com/rtti/PushPort/Forecasts/v2" ts="2016-07-26T20:51:30.9941484+01:00" version="12.0"&gt;
   &lt;uR updateOrigin="TD"&gt;
    &lt;TS rid="201607264120116" ssd="2016-07-26" uid="W44875"&gt;
     &lt;ns3:Location tpl="LEEE" wtp="21:00:30"&gt;
      &lt;ns3:pass et="20:57" src="TD"/&gt;
      &lt;ns3:plat cisPlatsup="true" platsrc="A" platsup="true"&gt;1&lt;/ns3:plat&gt;
     &lt;/ns3:Location&gt;
    &lt;ns3:Location tpl="LEESPRJ" wtp="21:02:30"&gt;
     &lt;ns3:pass et="20:59" src="Darwin"/&gt;
    &lt;/ns3:Location&gt;
    &lt;ns3:Location tpl="GRVPDCE" wtp="21:15:30"&gt;
     &lt;ns3:pass et="21:12" src="Darwin"/&gt;
    &lt;/ns3:Location&gt;
    &lt;ns3:Location tpl="GRVPCSD" wta="21:21"&gt;
     &lt;ns3:arr et="21:17" src="Darwin"/&gt;
     &lt;ns3:pass et="20:59" src="Darwin"/&gt;
    &lt;/ns3:Location&gt;
   &lt;/TS&gt;
  &lt;/uR&gt;
 &lt;/Pport&gt;
</code></pre>

<p>Here is part of my code:</p>

<pre><code>try {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    DocumentBuilder builder = factory.newDocumentBuilder();
    InputSource is = new InputSource(new StringReader(xml));
    Document doc = builder.parse(is);

    doc.getDocumentElement().normalize();
    System.out.println("Root Element : " + doc.getDocumentElement().getNodeName());

    NodeList nList = doc.getElementsByTagNameNS(
        "http://www.thalesgroup.com/rtti/PushPort/Forecasts/v2", "Location");
    int totalBooks = nList.getLength();
    System.out.println(totalBooks);

    for (int i = 0; i &lt; nList.getLength(); i++) {
        Node nNode = nList.item(i);
        if (nNode.getNodeType() == Node.ELEMENT_NODE) {
            Element eElement = (Element) nNode;
            System.out.println(eElement.getAttribute("tpl"));

            String tpl = eElement.getAttribute("tpl");
            String pta = eElement.getAttribute("pta");
            String ptd = eElement.getAttribute("ptd");
            String wta = eElement.getAttribute("wta");
            String wtd = eElement.getAttribute("wtd");

            //New Code 2
            System.out.println(eElement.getElementsByTagNameNS(
                "http://www.thalesgroup.com/rtti/PushPort/Forecasts/v2","arr").getAttribute("et"));

            String query = "insert into darwinall (tpl,timestamp,pta,ptd,wta,wtd)"
            + "values(?,?,?,?,?,?)";
            try {
                PreparedStatement preparedStmt = connectOut.connect().prepareStatement(query);
                preparedStmt.setString(1, tpl);
                preparedStmt.setInt(2, 123456);
                preparedStmt.setString(3, pta);
                preparedStmt.setString(4, ptd);
                preparedStmt.setString(5, wta);
                preparedStmt.setString(6, wtd);

                preparedStmt.execute();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
} catch (Exception ex) {
    ex.printStackTrace();
}
</code></pre>

<p>I can successfully get attributes tpl,pta,ptd,wta and wtd. However I cannot get the attribute for <strong>"et"</strong> within the node namespace <strong>ns3:arr</strong>. I do not want to get the "et" within <strong>ns3:pass</strong>. The answer I am after is 21.17. I am cycling through the ns3:Location nodes. The piece of code thats at fault is under //New Code 2. I get an error saying...The method getAttribute(String) is undefined for the type NodeList. Any help appreciated</p>