'Pretty prints' an XML field. The function formats an XML field for improved readability. This can be an expensive operation.

It is recommended to apply xml:prettyPrint() after filtering your data at the end of the query. This prevents unnecessary formatting of data that will be discarded.

Default behaviour is as follows:

  • If the field does not contain valid XML, the unmodified input value is stored in the output field.

  • If no field is specified, the @rawstring field will be formatted.

ParameterTypeRequiredDefault ValueDescription
asstringoptional[a]   The name of the field to store the output in.
field[b]stringrequired @rawstring The name of the field to format.
stepintegeroptional[a] 2 The indentation in number of characters.
strictbooleanoptional[a] false If set to true only valid XML input produce a value in the output field. By default invalid XML is copied to the output field unmodified.
widthintegeroptional[a] 80 The width (in number of characters) to fit the output input.

[a] Optional parameters use their default value unless explicitly set.

[b] The parameter name field can be omitted.

Hide omitted argument names for this function

Show omitted argument names for this function

Click + next to an example below to get the full details.

Format Only Valid XML

Format only XML data that is considered valid using the xml:prettyPrint() function

Format XML

Format XML in @rawstring field using the xml:prettyPrint() function

Format XML to a Max Line Length

Format XML in @rawstring field using the xml:prettyPrint() function with custom formatting parameters set