Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoformat on Save and empty XML-Elements #430

Closed
plutowalker opened this issue Dec 10, 2024 · 4 comments
Closed

Autoformat on Save and empty XML-Elements #430

plutowalker opened this issue Dec 10, 2024 · 4 comments

Comments

@plutowalker
Copy link

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

@lovettchris
Copy link
Member

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

@plutowalker
Copy link
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

lovettchris added a commit that referenced this issue Dec 10, 2024
Formatting Options has new setting to format Xml attributes each on a separate line.
Publish new version 2.9.0.16
@lovettchris
Copy link
Member

lovettchris commented Dec 10, 2024

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.

@plutowalker
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants