title: Get specific attribute value from xml in Java
body: <p>I am trying to parse following XML using Java.</p>
  
  <pre><code>    &lt;connection inherit="true" name="test"&gt;
        &lt;ConnectionDetails&gt;
          &lt;conn name="domainname1.net"&gt;
              &lt;prop name="dom-test" tags="1-test, con"/&gt;
          &lt;/conn&gt;
          &lt;conn name="domainname2.net"&gt;
              &lt;prop name="dom-test" tags="2-test, con"/&gt;
          &lt;/conn&gt;
          &lt;conn name="domainname3.net"&gt;
              &lt;prop name="dom-org" tags="org, con"/&gt;
          &lt;/conn&gt;
          &lt;conn name="domainname4.net"&gt;
              &lt;prop name="dom-test" tags="3-test"/&gt;
          &lt;/conn&gt;
          &lt;conn name="domainname5.net"&gt;
             &lt;prop name="dom-org" tags="org"/&gt;
          &lt;/conn&gt;
        &lt;/ConnectionDetails&gt;
   &lt;/connection&gt;
  </code></pre>
  
  <p>I have wrote Java code like :</p>
  
  <pre><code>File inputFile = new File("test.xml");
  DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
  DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
  Document doc = dBuilder.parse(inputFile);
  doc.getDocumentElement().normalize();
  NodeList nList = doc.getElementsByTagName("conn");
  </code></pre>
  
  <p>What I need is: </p>
  
  <blockquote>
    <ul>
    <li>To get all connection with tag that contains the text "test"
         - domainname1.net, domainname2.net, domainname4.net</li>
    </ul>
  </blockquote>
  
  <p>Please help!</p>