 <p>If you really want to use NodeList, you can do this:</p> <pre><code>nList.item(i).setNodeValue(a.item(i).getNodeValue()); </code></pre> <p>The better way to do it is just with a List as cmbaxter suggested, though.</p> <pre><code>List&lt;Node&gt; nodes = new ArrayList&lt;Node&gt;(); </code></pre>