title: xml2js: how is the output?
body: <p>I m trying to use the node.js module xml2js</p>
  
  <p>My code is quite simple:</p>
  
  <pre><code>function testparse(pathname, callback) {
      var parser = require('xml2js').Parser(),
          util = require('util'),
          fs = require('fs'),
      fs.readFile(pathname, function (err, data) {
          parser.parseString(data, function(err, result) {
              console.log('Complete result:');
              console.log(util.inspect(result, {depth: null})); //Work
              console.log('Try to access element:');
              console.log(result.smil.body); //Work
              console.log(result.smil.body.update); //Undefined
          });
      });
  }
  </code></pre>
  
  <p>My xml file is as:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;smil&gt;
      &lt;head/&gt;
      &lt;body&gt;
          &lt;update /*some field*//&gt;
          &lt;stream name="name"/&gt;
          &lt;playlist /*some field*/&gt;
              &lt;video /*some field*//&gt;
              &lt;video /*some field*//&gt;
              &lt;video /*some field*//&gt;
          &lt;/playlist&gt;
      &lt;/body&gt;
  &lt;/smil&gt;
  </code></pre>
  
  <p>The output give me:</p>
  
  <pre><code>Complete result:
  { smil:
      { head: [''],
        body:
          [ { update: [[Object]],
              stream: [[Object]],
              playlist: [[Object]] } ] } }
  Try to access element:
  [Object]
  Undefined
  </code></pre>
  
  <p>I have succeed in accessing body by trying, but now I m stuck, is there a template or example of how xml2js output the parsed xml somewhere?</p>