-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(internal): marshal self-closing tags in XML (#1225)
Currently self-closing tags are marshaled as `<a></a>` which is not the preferred format `<a/>`. With the current implementation of `encoding/xml`, self-closing tags are expanded to `StartElement` and `EndElement` so both elements are written to output. In this PR, a field `Empty` is added to both elements to indicate whether the current element is empty. During encoding: - `/` is written before `>` for an empty `StartElement` - nothing will be written for an empty `EndElement` Considering that we only want tabs not being escaped, this PR modifies `escapeNewline` to `escapeWhitespace` to indicate if we want all whitespace characters escaped.
- Loading branch information
Showing
6 changed files
with
189 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.