Hi all!

I simply want the XML files my program outputs to not have newline 
characters escaped into 
. My input XML files contain newlines and I 
want to preserve them.

This snippet shows my issue / inconsistency: 
https://play.golang.org/p/etosjWbkLn

I've researched and found that encoding/xml's EncodeToken on a CharData 
Token treats the newline properly. But Encoder.Encode(), which is my 
standard use case of just writing to a file, escapes newlines.

I've dug through the documentation, google searches, and the encoding/xml 
source code and tests but can't find out how I'm supposed to preserve 
newlines for just encoding the data in my struct. This feels like a bug / 
inconsistency, but I'm also not super familiar with the "go" way of doing 
things.

Help is much appreciated, thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to