-
Notifications
You must be signed in to change notification settings - Fork 377
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
Unexpected diff when writing XML #1184
Comments
#1184 When encoding tokens to pom.xml, tabs are escaped and this is not what we want. In this PR, before writing to pom.xml, we replace all escaped tabs with unescaped characters.
Not only tabs are escaped but also other characters: https://github.com/golang/go/blob/master/src/encoding/xml/xml.go#L1916 |
Besides the escaped texts, due to issue golang/go#21399 self-closing tags are not encoded as expected. We may consider refactoring how to write XMLs: instead of calling |
#1184 Currently, texts are escaped in `xml.EncodeToken()` and this generates unexpected diff when writing updates to XML. This PR adds `func encodeToken()` that writes `CharData` directly to avoid escaping, and all buffered XML is flushed after encoding. This PR also fixes #1215 by adding two more space to indentation.
#1184 We would like to modify Go's implementation on self-closing tags and this PR is the first step: - add `encoding/xml` to `internal/thirdparty` (also ignore this directory for lint) - make Maven manifest writing to use the internal version of `xml` - modify `xml` to not escape char data so we can call `xml.EncodeToken()`
Are there remaining issues to track here, or can we close this @cuixq ? |
I noticed one issue of multiple-line self-closing tag encoded into one line:
is now
this seems low priority though. |
Going to track this in separate issues. |
Texts are escaped to
	
when we write XML in Maven updater.Go does escaping in
EncodeToken
: https://github.com/golang/go/blob/master/src/encoding/xml/marshal.go#L223The text was updated successfully, but these errors were encountered: