On Fri, Nov 4, 2016 at 4:32 PM, Tong Sun <suntong...@gmail.com> wrote: > How to beautify a given XML string in GO? > > The xml.MarshalIndent() only apply to a GO structure, not XML strings.
Sorry, third time's the charm. I think I didn't understand what you were asking. If all you need is the bulit in indentation you can use an encoder and its indent method: https://godoc.org/encoding/xml#Encoder.Indent This is what MarshalIndent is doing under the hood. My example still applies, but you don't have to do it yourself. Instead you can just set the indentation on the encoder: https://play.golang.org/p/dVJjYvdHpS —Sam -- Sam Whited pub 4096R/54083AE104EA7AD3 -- 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.