title: Loop inside loop?
body: <p>I have created a loop in JavaScript that reads out the name of my nodes and the value inside.</p>
  <p>The loop works for the first node and the second one, but on the rest of the nodes it's just repeating the value of the second node.</p>
  <p>So the output gets like this:</p>
  <blockquote>
  <pre><code> Name on nod 1 is title
   The value in the node is XML Content and Data
  
   Name on nod 2 is Author
   The value in the node is XML Content and Data
  </code></pre>
  </blockquote>
  <p>Et cetera.</p>
  <p>Should I create a loop inside the loop? Ir can I multiloop the entire tree?</p>
  <pre class="lang-js prettyprint-override"><code>if (xmlDoc.parseError != 0) {
      alert(&quot;Error Code: &quot; + xmlDoc.parseError.errorCode + &quot;\n&quot;
          + &quot;Error Reason: &quot; + xmlDoc.parseError.reason + &quot;\n&quot;
          + &quot;Error Line: &quot; + xmlDoc.parseError.line)
  }
  root = xmlDoc.documentElement
  rootList = root.childNodes
  len = rootList.length
  
  x = xmlDoc.getElementsByTagName(&quot;title&quot;)[0]
  y = x.childNodes[0];
  
  for (i = 0; i &lt; len; i++) {
      j = i + 1
      document.write(&quot;Name on nod &quot; + j + &quot; is &quot; + rootList.item(i).nodeName + &quot;&lt;br /&gt;&quot;)
      document.write(&quot; value of the the nod is  &quot; + y.nodeValue + &quot;&lt;br /&gt;&quot; + &quot;&lt;br /&gt;&quot;);
  }
  </code></pre>