XML Formatter

Usage

The XML Formatter is used to format XML input messages.

The content of an XML file can be contained in a single, long line. For humans, this type of display is difficult to read, and in the case of larger files, it can be nearly impossible to comprehend. The XML Formatter adds indents and line breaks so that you can work with a legible structure.

Example for XML Formatter Input and Output Messages

Input message

<?xml version="1.0" encoding="ISO-8859-1"?>
<Invoice>
    <test1>
        <ArticleId>1</ArticleId>
        <Price>1</Price>
    </test1>
</Invoice>

Output message

<?xml version="1.0" encoding="UTF-8"?>
<Invoice>
  <test1>
    <ArticleId>1</ArticleId>
    <Price>1</Price>
  </test1>
</Invoice>

XML Formatter Properties Dialog

Indentations

  • Indent XML elements

    Indents XML elements in accordance with their hierarchical position.

  • Number of whitespaces

    Determines the degree of indentation for the element. The default value is 2. To restore the value after, click the Default button.

Newlines

Add newlines

Adds a line break after 80 characters. This prevents the need for horizontal scrolling. In some cases, however, this option makes an overview more difficult.

White Spaces

If you leave the checkbox unchecked, the white spaces remain untouched in the XML output.

  • Trim all Whitespaces

    When activated, all white spaces, line breaks, and control characters, for example tabs, are removed.

  • Remove leading and trailing white spaces

    When activated, all leading and trailing white spaces are removed.

Namespaces

Activates the following options to optimize the namespaces.

  • Optimize namespaces

    Removes all duplicate and unused namespace declarations.

  • Remove listed namespaces

    Removes all namespace declarations indicated in a list; to create the list, click Edit list.

  • Remove all namespaces

    Removes all namespace declarations.

Encoding

Character set of the output message

Defines the character set for the output.

The default setting is the ISO-8859-1 character set. This is the default character set containing all characters used in the major Western European languages (including their country-specific special characters).

Alternatively, you can enter any other character set.