title: How do i remove unwanted spaces from exported XML data being loaded into javascript
body: <p>I've seen similar questions and answers to what i need, But my spaces are in a different place to the other questions i've seen.</p>
  
  <p>I am exporting data from the employee database into an XML file which is then loaded into HTML via javascript.</p>
  
  <p>Below is an example slice of how the XML data is retrieved from the employee database.</p>
  
  <pre><code>&lt;employee&gt;
       &lt;id&gt;2552      &lt;/id&gt;
       &lt;name&gt;BOBBY                LEE              &lt;/name&gt;
       &lt;team&gt;BOB  &lt;/team&gt;
       &lt;datein&gt;      78130&lt;/datein&gt;
       &lt;timein&gt; 055541    &lt;/timein&gt;
       &lt;dateout&gt;     78129&lt;/dateout&gt; 
       &lt;timeout&gt; 140128&lt;/timeout&gt;
        &lt;active&gt;Yes&lt;/active&gt;
  &lt;/employee&gt;
  </code></pre>
  
  <p>As you can see there are spaces in the extracted data. I am using the employee id to pull an image file. So for this employee i would use the id (2552      ) Though as it has 6 spaces i cannot call the image file (2552      .png) as that won't work.</p>
  
  <p>Is there a way i can remove the 6 spaces so that i can load a file called 2552.png?</p>
  
  <p>Thanks.</p>
  
  <p>EDIT #1</p>
  
  <pre><code>var x = xmlDoc.getElementsByTagName("employee");
  
  for (i = 0; i &lt; 4; i++)
  {
      document.write("&lt;table border='0'&gt;");
      document.write("&lt;tr&gt;&lt;td id=pic&gt;&lt;img src=../images/employees/");
      document.write(x[i].getElementsByTagName("id")[0].childNodes[0].nodeValue);
      document.write(".png width=100 height=100&gt;&lt;/td&gt;&lt;td id=Yes&gt;");
      document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);
      document.write("&lt;/td&gt;&lt;/tr&gt;");
      document.write("&lt;/table&gt;");
  }
  </code></pre>
  
  <p>That is the code i use to pull information from the XML file.</p>
  
  <p>EDIT #2</p>
  
  <pre><code>xmlhttp = new XMLHttpRequest();
  xmlhttp.open("GET", "DATA.xml", false);
  xmlhttp.send();
  xmlDoc = xmlhttp.responseXML;
  </code></pre>
  
  <p>XML load code, which is stored in the header.</p>