FAQ
I have a short example that seems to show a bug with xml.Marshal():

http://play.golang.org/p/KuGg_5x13n


I am marshalling the structs Set and Set2 (defined below). The results for
Set seem to be wrong. Using Set2 provides a workaround for Set, but I
think the Set example is still a bug. (The example behaves similarly when
using the attribute "innerxml" instead of "chardata".)

type Set struct {
A [2]string `xml:"A>B"`
S string `xml:",chardata"`
}

type CT struct {
D [2]string
}

type Set2 struct {
C CT
S string `xml:",chardata"`
}

The output is as follows:

<Set>

<A>
<B></B>
<B></B>
Wrong?
</A>
</Set>

<Set2>
<C>
<D></D>
<D></D>
</C>
Right?
</Set2>



--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Russ Cox at Mar 18, 2013 at 2:16 pm
    golang.org/issue/5072

    --
    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 [email protected].
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 16, '13 at 11:34a
activeMar 18, '13 at 2:16p
posts2
users2
websitegolang.org

2 users in discussion

Russ Cox: 1 post Ntufnel: 1 post

People

Translate

site design / logo © 2023 Grokbase