title: javascript, loop string xml inside for loop
body: <p>hey guys  I have trouble with loop string for xml inside for loop. I have tried this and the loop is not work</p>
  <pre><code>var data = [{&quot;name&quot;: &quot;Tom&quot;, age: &quot;20&quot;}, {&quot;name&quot;: &quot;Jerry&quot;, age: &quot;20&quot;}]
  
  for (i = 0; i &lt; data.length; i++) {
     var xmltext = '&lt;Placemark&gt;\n' + 
          '\t&lt;name&gt;' + data[i].name + '&lt;/name&gt;\n' +
          '\t&lt;age&gt;' + data[i].age + '&lt;/age&gt;\n' +
          '&lt;/Placemark&gt;';
  }
  
  var filename = &quot;file.xml&quot;;
  var bb = new Blob([xmltext], {type: 'text/xml'});
  
  document.getElementById('download').setAttribute('href', window.URL.createObjectURL(bb));
  document.getElementById('download').setAttribute('download', filename);
  </code></pre>
  <p>the result I expected in xml</p>
  <pre><code>&lt;Placemark&gt;
    &lt;name&gt;Tom&lt;/name&gt;
    &lt;Age&gt;20&lt;/Age&gt;
  &lt;/Placemark&gt;
  &lt;Placemark&gt;
    &lt;name&gt;Jerry&lt;/name&gt;
    &lt;Age&gt;20&lt;/Age&gt;
  &lt;/Placemark&gt;
  </code></pre>
  <p>is there something i'm missing or i'm doing it wrong? I wish your help</p>