Closed bombsimon closed 5 years ago
Thanks for the report! Your fix looks reasonable. Can you make a PR?
@droyo Cool! Yeah of course, I created a PR with the changes and some tests to confirm this.
The Travis build failed. Do you want me to look into that or do you know why that is?
Thank you for a great library! It's been really helpful for me to use while traversing XML.
I'm using the library to marshal XML from
xmltree.Element
. The XML generated will in some cases be read by a human and because of that I'm usingxmltree.MarshalIndent
. The problem is that the XML generated includes too much leading and trailing whitespaces so when being unmarshalled back to the original type (with standard library) the content includes unwanted newlines.Example to reproduce
Output
This change to
xmltree/marshal.go
seems to fix my issues:So while running the example again with the above changes this is the output:
Am I missing something or do you agree that this is a bug? If you agree, do you want me to create a PR?
Thanks!