-
Notifications
You must be signed in to change notification settings - Fork 18k
encoding/xml: Marshal doesn't understand "parent>child" struct tags #2119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
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. Status changed to Accepted. |
I ran into this problem myself, and I wrote a quick patch for it. It works for my needs. http://golang.org/cl/4941042 |
This issue was closed by revision 4541fa9. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Attachments:
The text was updated successfully, but these errors were encountered: