title: xml2js: put parser into a function
body: <p>I got this code on my NodeJS server:</p>
  
  <pre><code>function GetXML() {
      fs.readFile('../slideshow.xml.old', function(err, data) {
          parser.parseString(data, function (err, result) {
              var json = JSON.stringify(result);
              console.log(json);
              return json;
          });
      });
  }
  </code></pre>
  
  <p>The <code>console.log()</code> is working well but this is not:</p>
  
  <pre><code>.get('/', function(req, res) {
      res.end(GetXML());
  };
  </code></pre>
  
  <p>It returns <code>undefined</code> which is quite logic because functions are nested (I think ?). But I don't know how to make GetXML() returning a value.</p>