Skip to content

Preserve empty-element formatting across versions #500

Description

@RFuenteM
Image

Description

When editing XML files with XmlNotepad and using Auto Format on Save, the representation of empty elements may change between versions.

For example, an empty element originally written as:

<Read Key="x" />

may be rewritten as:

<Read Key="x"></Read>

Both forms are semantically equivalent XML, so this is not a functional issue. However, it creates unnecessary noise in source control systems such as Git, especially in repositories where XML files are frequently reviewed and compared.

Expected behavior

When Auto Format on Save is enabled, XmlNotepad should preserve a consistent representation of empty elements.

Possible approaches:

  • Preserve the original style already present in the document.

  • Provide a formatting option allowing users to choose between:

    • Self-closing tags (<Tag />)
    • Explicit opening/closing tags (<Tag></Tag>)
  • At minimum, avoid changing the formatting style between XmlNotepad versions.

Actual behavior

After upgrading XmlNotepad, saving an XML document may rewrite empty elements using a different representation than previous versions, generating large diffs with no semantic changes.

Why this matters

In environments where XML files are stored in Git:

  • Reviews become harder because diffs contain formatting-only changes.
  • Merges may become noisier.
  • Upgrading the editor can unexpectedly modify many files.

The formatting style itself is not important; consistency is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions