Fixed BZ#812716 - Extra whitespace added when saving.
Updated the nodeToString method to handle inline comments better.