OutputFormat
The detailed behavior of a serializer is controlled by an OutputFormat object. This class can configure almost any aspect of serialization, including setting the maximum line length, changing the indentation, specifying which elements have their text escaped as CDATA sections, and more. A few options even have the potential to make your documents malformed. For example, if you add an element to the list of nonescaping elements, then any reserved characters like < and & that appear in its text content will be output as themselves rather than escaped as < and &.
One of the most frequent requests for serializers is “pretty printing” data with extra line breaks and indentation. Within reasonable limits, the OutputFormat class ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access