microsoft / microsoft/XmlNotepad
Preserve empty-element formatting across versions
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 1.2k
- Forks
- 240
- PR merge metrics
- No merged PRs in 30d
Description
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>)
- Self-closing tags (
-
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior in XmlNotepad by enabling Auto Format on Save and saving XML containing an empty element in both supported representations. Trace the save-formatting path from that reproduction and determine how the current version chooses the representation. Done means repeated saves and upgrades do not introduce inconsistent empty-element formatting, with behavior covered by an appropriate regression test if the project provides one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100