Skip to content
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

encoding/xml: Marshal ignores XMLName field from anonymous struct field #7614

Closed
gopherbot opened this issue Mar 23, 2014 · 3 comments
Closed
Milestone

Comments

@gopherbot
Copy link

by alex.vizor:

What does 'go version' print?
go version go1.2.1 linux/amd64

What steps reproduce the problem?
Just to http://play.golang.org/p/85oWtwZAq9 and Run.

What happened?
Embedded struct defines XMLName field with xml.Name type and with corresponding field
tag. xml.Marshal ignores this XMLName field from embeded struct and outer tag is
generated from object's struct type name.

What should have happened instead?
Documentation for xml.Marshal says:
- an anonymous struct field is handled as if the fields of its
  value were part of the outer struct.
So I expected that XMLName of type xml.Name from embedded struct should be marshaled as
xml tag name.

Please provide any additional information below.
@ianlancetaylor
Copy link
Contributor

Comment 1:

Related to issue #7522?

Labels changed: added repo-main, release-go1.3maybe.

@gopherbot
Copy link
Author

Comment 2 by alex.vizor:

Not sure if this related. Here we don't have non-exported fields and it doesn't work on
go 1.2.1 either. I actually prepared a CL for this issue.
https://golang.org/cl/79210044/

@rsc
Copy link
Contributor

rsc commented Apr 8, 2014

Comment 3:

This issue was closed by revision 4b42ad2.

Status changed to Fixed.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants