added option to create the main document containing comments and first level nodes.
For a document like
<project>
  <version>
     1.2.3
  </version>
</project>
Without creating main document you would access version with:
   xmlDoc.child('version')
with create main document:
   xmlDoc.child('project').child('version').

This allows the correct export of the XML file only changing white spaces which was what I needed