Skip to content

XML Beautifier

The generator XML Beautifier takes one or more XML files as input and does nothing else than sorting the attributes of each tag alphabetically and placing every attribute on a separate line. It is capable of handling input files with the following file name extensions: xml, html, xhtml, htm, xsd.

Object and Purpose

XML files are transformed to become much easier to read by a human being. The content of the input file remains exactly the same as before.

One of the use-cases for this generator is to improve the structure of existing, manually written XHTML files that initially were created by a JSF generator that doesn’t sort attributes alphabetically or/and that places more than one attribute on one line. After having improved the layout of such XHTML files it becomes much easier to compare manually modified XHTML files with 100% generated ones.

Generator Options

Option Name Option Description Value Range Default Value
textfile‑modelaccess.root‑dir This option defines the directory that the generator assumes to be the root directory from where the input files were taken. It uses this value to prepend it to the file URI of the generated files in order to be able to write generated files to the same location as where the input came from. src/main/resources
xml‑beautifier.filename.postifx The generator determines the name of the generated file by using the original file name and appending this postfix. If the option value is an empty string, the generator orverwrites the input file. any sequence of characters that are valid to be used for file names 2
target.uri.prefix the directory that files are written into An empty string is the default value since the target directory is typically being set by using the option textfile-modelaccess.root-dir