Re: [go-nuts] Marshal XML Mixed Content

2016-10-11 Thread Konstantin Khomoutov
On Tue, 11 Oct 2016 10:00:33 -0700 (PDT) sm...@brillig.org wrote: [...] > > > I'm trying to Marshal XML where an element has mixed content: > > > https://www.w3.org/TR/REC-xml/#sec-mixed-content > > > > > > I tried just using []interface{} but if I put in just a string, > > > Marshal surrounds

Re: [go-nuts] Marshal XML Mixed Content

2016-10-11 Thread Konstantin Khomoutov
On Tue, 11 Oct 2016 10:12:50 -0700 (PDT) sm...@brillig.org wrote: [...] > >> > I'm trying to Marshal XML where an element has mixed content: > >> > https://www.w3.org/TR/REC-xml/#sec-mixed-content > >> > > >> > I tried just using []interface{} but if I put in just a string, > >> > Marshal surr

Re: [go-nuts] Marshal XML Mixed Content

2016-10-11 Thread smw12
I figured out a solution: https://play.golang.org/p/sWR1hAumYh I created a type that wraps string and implements the xml.Marshaler interface. Then I just cast my strings to that type. Hey go team, any chance this could be made the default behavior for xml.CharData types so a single cast would

Re: [go-nuts] Marshal XML Mixed Content

2016-10-11 Thread smw12
Sorry, I should have been more clear. The reason I used a slice was because I need an arbitrary number of elements. So I can't just use a static struct with the chardata tags. On Tuesday, October 11, 2016 at 4:49:34 AM UTC-7, Konstantin Khomoutov wrote: > > On Mon, 10 Oct 2016 22:10:37 -0700 (

Re: [go-nuts] Marshal XML Mixed Content

2016-10-11 Thread Konstantin Khomoutov
On Mon, 10 Oct 2016 22:10:37 -0700 (PDT) Scott wrote: > I'm trying to Marshal XML where an element has mixed content: > https://www.w3.org/TR/REC-xml/#sec-mixed-content > > I tried just using []interface{} but if I put in just a string, > Marshal surrounds each string with the name of the slice

[go-nuts] Marshal XML Mixed Content

2016-10-10 Thread Scott
I'm trying to Marshal XML where an element has mixed content: https://www.w3.org/TR/REC-xml/#sec-mixed-content I tried just using []interface{} but if I put in just a string, Marshal surrounds each string with the name of the slice: https://play.golang.org/p/erh3mQmrZD I'm trying to get the ou