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

Comments

Projects
None yet
3 participants
@gopherbot
Copy link

gopherbot commented Mar 23, 2014

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

This comment has been minimized.

Copy link
Contributor

ianlancetaylor commented Mar 23, 2014

Comment 1:

Related to issue #7522?

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

@gopherbot

This comment has been minimized.

Copy link
Author

gopherbot commented Mar 23, 2014

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

This comment has been minimized.

Copy link
Contributor

rsc commented Apr 8, 2014

Comment 3:

This issue was closed by revision 4b42ad2.

Status changed to Fixed.

@gopherbot gopherbot added fixed labels Apr 8, 2014

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015

@rsc rsc removed the release-go1.3maybe label 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.
You can’t perform that action at this time.
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.