title: Loop through XML nodes and store as JavaScript variables
body: <p>I am new to JavaScript and I am trying to read an XML file and extract its content into JavaScript variables.</p>
  
  <p>Here is an example of the content of my XML file:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;!-- Locations of current projects --&gt;
  &lt;projectsites&gt;
   &lt;li&gt;
    &lt;title&gt;Battling Ninja Army&lt;/title&gt;
    &lt;location&gt;Osaka, Japan&lt;/location&gt;
    &lt;lat&gt;34.69&lt;/lat&gt;
    &lt;lon&gt;135.50&lt;/lon&gt;
   &lt;/li&gt;
   &lt;li&gt;
    &lt;title&gt;Software Development&lt;/title&gt;
    &lt;location&gt;Vienna, Austria&lt;/location&gt;
    &lt;lat&gt;48.21&lt;/lat&gt;
    &lt;lon&gt;16.37&lt;/lon&gt;
   &lt;/li&gt;
  &lt;/projectsites&gt;
  &lt;!-- Locations of current developers --&gt;
  &lt;developersites&gt;
   &lt;li&gt;
    &lt;title&gt;Brisbane office&lt;/title&gt;
    &lt;location&gt;Brisbane, Australia&lt;/location&gt;
    &lt;lat&gt;-27.4&lt;/lat&gt;
    &lt;lon&gt;153&lt;/lon&gt;
   &lt;/li&gt;
   &lt;li&gt;
    &lt;title&gt;Phillipines Office&lt;/title&gt;
    &lt;location&gt;Manilla, Phillipines&lt;/location&gt;
    &lt;lat&gt;14.7&lt;/lat&gt;
    &lt;lon&gt;121&lt;/lon&gt;
   &lt;/li&gt;
  &lt;/developersites&gt;
  </code></pre>
  
  <p>So, presuming that I have more data than this, can I create a loop or nested loops in JavaScript that reads the XML file and extracts the data into arrays? Examples of elements that I am interested in are: <code>projectsites.title</code>, <code>projectsites.lat</code>, <code>developersites.title</code> and <code>developersites.lat</code>.</p>