Skip to content

Improve formatting of Processing Instructions #240

@anthonyvdotbe

Description

@anthonyvdotbe

The formatter formats an XML declaration as follows:

<?xml version="1.0" encoding="UTF-8" ?>

But tools such as Maven generate XML files with an XML declaration as follows (i.e. without a trailing space before the closing tag):

<?xml version="1.0" encoding="UTF-8"?>

This is particularly annoying, because the XML declaration is constantly changed: to version B each time Maven rewrites the XML file (e.g. when doing a release), and then again to version A when the formatter formats the file.

So I think the best option is to format XML declarations as follows:

  • if there's already trailing whitespace before the closing tag, collapse it to a single space character
  • else, don't add any whitespace

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions