You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Build & run the two attached tiny examples and you'll see the problem. (The first
example is based on the Email/Results example in the xml package's documentation.)
I expect xml.Unmarshal to correctly read a data structure that was correctly written
with xml.Marshal.
Which compiler are you using (5g, 6g, 8g, gccgo)?
6g
Which operating system are you using?
Linux 64-bit (debian & Ubuntu)
Which revision are you using? (hg identify)
I tried with 2 same results for both:
3c21f37b25a3+ weekly.2011-07-19
bb28251f6da4 weekly/weekly.2011-07-29
See also https://golang.org/issue/1989
The problem is that the data isn't correctly written by xml.Marshal in the first place.
It seems the "parent>child" form in the struct tag doesn't work with xml.Marshal. The
program xmltest1.go generates invalid xml for this data structure:
Result struct {
// other fields omitted
Groups []string `xml:"group>value"`
}
<result>...omitted...<group>value>Friends</group>value><group>value>Squash</group>value></result>
When I manually fix up the invalid tags here, xml.Unmarshal correctly loads the contents
of the value elements into the Groups slice.
The summary name change is wrong. If you try xmltest2.go you will see that it does not
use the "parent>child" syntax -- and yet it still fails to work correctly.
So perhaps this should be split into two separate bugs?
Attachments:
The text was updated successfully, but these errors were encountered: