Fixed the bug that after RelaxNG validation errors, the original document was displayed again with the user's changes lost. Added some comments and applied some formatting.
Changed paths: