Skip to content

Autoformat on Save and empty XML-Elements #430

Closed

Description

@plutowalker

Hello,

I think, i've found a little error today when using Autoformat on Saving of a XML-Document with empty XML-Elements in long format (<...></...>) in content. In my option XML Notepad insert not allowed Spaces and line breaks as value between the start-tag and end-tag. Outside of XML-Elements this is allowed and makes no problems but inside of a XML-Element this is problematic and changes the content of this XML-Element.

As exmaple the free texteditor Notepad++ with extension XML Tools works a little bit other. Notepad++ converts such empty XML-Elements in long format (<...></...>) to the correspoding short format (<.../>) without insert additional spaces or line breaks. That behaviour makes no problems and is also allowed in XML.

It would be nice if this point can be checked and corrected because XML Notepad is a great tool for me every day.

Best regards
Plutowalker

Activity

  1. lovettchris commented on Dec 10, 2024

    @lovettchris
    Collaborator

    I agree this is bug, thanks for the report, I will look into it.

  2. plutowalker commented on Dec 10, 2024

    @plutowalker
    Author

    Alternativly, an empty XML-Element in long format can placed completely in one line but not start-tag and end-tag interrupted in two following lines. Both formats (long and short) are allowed in my option and equivalent. Personally I prefer the short format ... it's clearer in a greater structured XML content.

    Best regards
    Plutowalker

  3. added a commit that references this issue on Dec 10, 2024
  4. lovettchris commented on Dec 10, 2024

    @lovettchris
    Collaborator

    Fixed in https://github.com/microsoft/XmlNotepad/releases/tag/2.9.0.16. The fix was to move to a new version of the XmlWriter provided in the .NET frameworks and with this writer the whitespace is not inserted, and the full end tag is preserved.

  5. plutowalker commented on Dec 12, 2024

    @plutowalker
    Author

    Many thanks for the quick correction. Great job :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions