title: get child nodes from parent (xml, java)
body: <p><strong>UPDATE</strong>
  i was specifically targeting staff under some root node, not all "staff" elements in the whole document. i forgot to mention this important detail in the question. sorry guys.  </p>
  
  <p>i found this answer to my question:<br>
  <a href="https://stackoverflow.com/questions/11947248/getelementsbytagname">getElementsByTagName</a></p>
  
  <p>But with this data:  </p>
  
  
  
  <pre><code>&lt;one&gt;
  &lt;two&gt;
      &lt;three&gt;
          &lt;company&gt;
  
              &lt;staff id="1001"&gt;
                  &lt;firstname&gt;Golf&lt;/firstname&gt;
                  &lt;lastname&gt;4&lt;/lastname&gt;
                  &lt;nickname&gt;Schnecke&lt;/nickname&gt;
                  &lt;salary&gt;1&lt;/salary&gt;
              &lt;/staff&gt;
              &lt;staff id="2001"&gt;
                  &lt;firstname&gt;Audi&lt;/firstname&gt;
                  &lt;lastname&gt;R8&lt;/lastname&gt;
                  &lt;nickname&gt;Rennaudi&lt;/nickname&gt;
                  &lt;salary&gt;1111111&lt;/salary&gt;
              &lt;/staff&gt;
              &lt;staff id="2002"&gt;
                  &lt;firstname&gt;Skoda&lt;/firstname&gt;
                  &lt;lastname&gt;xyz&lt;/lastname&gt;
                  &lt;nickname&gt;xyz&lt;/nickname&gt;
                  &lt;salary&gt;0.1&lt;/salary&gt;
              &lt;/staff&gt;
  
          &lt;/company&gt;
      &lt;/three&gt;
  &lt;/two&gt;
  &lt;/one&gt;
  </code></pre>
  
  <p>and this code:</p>
  
  <pre><code>public static void parseXML2() {
      File fXmlFile = new File("src\\main\\java\\staff.xml");
          DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
          DocumentBuilder dBuilder = null;
      try {
          dBuilder = dbFactory.newDocumentBuilder();
      } catch (ParserConfigurationException ex) {
          Logger.getLogger(MyParser.class.getName()).log(Level.SEVERE, null, ex);
      }
          Document doc = null;
      try {
          doc = dBuilder.parse(fXmlFile);
      } catch (SAXException ex) {
          Logger.getLogger(MyParser.class.getName()).log(Level.SEVERE, null, ex);
      } catch (IOException ex) {
          Logger.getLogger(MyParser.class.getName()).log(Level.SEVERE, null, ex);
      }
      System.out.println("test");
         System.out.println(doc.getElementsByTagName("company").item(0).getTextContent());
  
  }
  </code></pre>
  
  <p>i dont get just one staff element, but all of them. how come?<br>
  i was expecting to get:  </p>
  
  <pre><code>                Golf
                  4
                  Schnecke
                  1
  </code></pre>
  
  <p>but instead i get this: </p>
  
  <pre><code>                Golf
                  4
                  Schnecke
                  1
  
  
                  Audi
                  R8
                  Rennaudi
                  1111111
  
  
                  Skoda
                  xyz
                  xyz
                  0.1
  </code></pre>
  
  <p>looks like your post is mostly code, please add more details...yes the details are there.</p>