TOOLS
  Home
  xmlpp
  xmldiff
  Schema Validation
  DECISIONSOFT
  Corporate
  Open Source
  Contact
  Terms of Use

XML Pretty Printer

File
Split attributes
Sort attributes
Comments on new lines
Normalise whitespace
Display as HTML
 
 

This XML pretty printer will output the XML with consistent indenting, based upon the logical nesting depth of the tags. Quoting characters are made consistent, and new lines are inserted between tags. It is designed for XML that contains no mixed content, and the behaviour is undefined on encountering mixed content.

The split attributes option controls whether or not it will place each attribute of an element on a new line. This can be helpful if the output is sent to diff, such as in xmldiff.

The sort attributes option causes xmlpp to sort the attributes on each element in alphabetical order. This makes it more consistent, allowing for easy comparisons.

Comments on new lines does exactly what you would expect

When enabled, Normalise whitespace will remove leading and trailing whitespace from text content. For example,

<Total> 45 </Total>

will become

<Total>45</Total>

If you select Display as HTML then, rather than returning the raw XML, it will embed it in <pre> tags, so that you can see the XML in your browser. This is most useful in Mozilla and Netscape 6, as they do not let you see the raw XML.

The source code to xmlpp is available here.