title: add same name xml node to a arrayList
body: <p>i have a problem with add xml file nodes to a object</p>
  
  <p>xml file :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Users&gt;
      &lt;User firstName="john"&gt;
          &lt;lastName&gt;fall&lt;/lastName&gt;
          &lt;score&gt;12&lt;/score&gt;
          &lt;score&gt;11&lt;/score&gt;
          &lt;score&gt;9&lt;/score&gt;
      &lt;/User&gt;
      &lt;User firstName="alen"&gt;
          &lt;lastName&gt;spring&lt;/lastName&gt;
          &lt;score&gt;17&lt;/score&gt;
          &lt;score&gt;15&lt;/score&gt;
      &lt;/User&gt;
  &lt;/Users&gt;
  </code></pre>
  
  <p>xml file have same <code>score</code> node with different value </p>
  
  <p>User class have 3 field <code>fName</code>, <code>lName</code>, <code>List&lt;Integer&gt; scores</code> 
  and scores filed use for add score node in xml file.</p>
  
  <p>User class:</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.List;
  
  public class User {
  
      private String fName;
      private String lName;
      private List&lt;Integer&gt; scores;
  
      public User() {
          this("firstName", "lastName", new ArrayList&lt;&gt;());
  
      }
  
      public User(String fName, String lName, List&lt;Integer&gt; scores) {
  
          setfName(fName);
          setlName(lName);
          setScores(scores);
  
      }
  
      public String getfName() {
          return fName;
      }
  
      public void setfName(String fName) {
          this.fName = fName;
      }
  
      public String getlName() {
          return lName;
      }
  
      public void setlName(String lName) {
          this.lName = lName;
      }
  
      public List&lt;Integer&gt; getScores() {
          return scores;
      }
  
      public void setScores(List&lt;Integer&gt; scores) {
          this.scores = scores;
      }
  
      public String toString() {
  
          StringBuilder sb = new StringBuilder();
  
          getScores().forEach(val -&gt; sb.append(String.format("%12d\n%18s", val, "")));
  
          return String.format("%-12s%s%s\n\n", getfName(), getlName(), sb.toString());
  
      }
  
  }
  </code></pre>
  
  <p>now i try to read xml file nodes and add to list of user objects :</p>
  
  <p>readXml method :</p>
  
  <pre><code>public static void readXml(String xmlFile) {
  
      Document doc = null;
  
      NodeList nList = null;
      NodeList nScoreList = null;
      Element el = null;
  
      String fName = null;
      String lName = null;
      List&lt;Integer&gt; scores;
  
      try {
  
          doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(xmlFile);
          doc.normalizeDocument();
  
          nList = doc.getElementsByTagName("User");
  
          scores = new ArrayList&lt;&gt;();
  
          for (int i = 0; i &lt; nList.getLength(); i++) {
  
              el = (Element) nList.item(i);
              fName = el.getAttribute("firstName");
              lName = el.getElementsByTagName("lastName").item(0).getTextContent();
  
              nScoreList = el.getElementsByTagName("score");
  
              for (int j = 0; j &lt; nScoreList.getLength(); j++)
                  scores.add(Integer.valueOf(nScoreList.item(j).getTextContent()));
  
              System.out.println(new User(fName, lName, scores));
  
          }
  
      } catch (Exception e) {
          e.printStackTrace();
      }
  
  }
  </code></pre>
  
  <p>output is :</p>
  
  <pre><code>john         fall           12
                              11
                               9
  
  
  
  alen        spring          12
                              11
                               9
                              17
                              15
  </code></pre>
  
  <p>but i need this output :</p>
  
  <pre><code>john         fall           12
                              11
                               9
  
  
  alen        spring          17
                              15
  </code></pre>
  
  <p>now what can i do for this problem ?</p>