You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(*Encoder).Encode and Marshal marshal line breaks as #xA; and tabs as #x9;
http://play.golang.org/p/elBX-TVXBL
It would be nice to have an option to marshal them (except in attributes) literally,
like so, for example:
encoder := xml.NewEncoder(...)
encoder.Literal = true
err := encoder.Encode(...)
// Output:
// <Foo>1
// 2
// 3</Foo>
The text was updated successfully, but these errors were encountered:
I think we would need a compelling reason to add such a feature, something more than it
would be nice. It should be possible to do this in the program by having the XML code
write to a Writer that translates the byte sequences where appropriate.
> It should be possible to do this in the program by having the XML code write to a
Writer that translates the byte sequences where appropriate.
Well, here it is. Sometimes you want your XML to be human readable, and encoding ", ',
\\, \n and \t as entities effectively prevents that.
Also, I don't see any reason at all why they should be encoded, except in attribute
values. Perhaps I should file another issue, titled "do not encode anything that needs
not to be encoded".
> It should be possible to do this in the program by having the XML code write to a
Writer that translates the byte sequences where appropriate.
There is a simpler and more efficient way - to fork the code and amend it. I don't want
to go for it.
by opennota:
The text was updated successfully, but these errors were encountered: