xb – XML beautifier


xb [ dM ][ file ]


Xb performs a DOM model, non–validating parse of the given XML file (or standard input if none specified). This is then written to standard output reformatted into an indented, one–line–per–element style.
Xb takes some liberties with the document which may effect later interpretation, though it is idempotent:
–     Re–formatting the will change the meaning of PCdata in the XML file if leading and trailing whitespace is significant.
–     All comments are stripped, though the DOCTYPE structured comment is preserved. A new XML version comment is always generated on the output.
–     Attributes are always quoted with single quotes whether the source uses single or double quotes.
–     Empty long form elements are replaced with their short form; for example:
fred a='1'>
is replaced with
<fred a='1' />
Xml has its own view of the valid characterset for XML files, which might result in slightly different characters being escaped as entity references to those on the input. This is only a matter of interpretation, the meaning of the file will be unaffected.