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: Marshaling of arrays drops the last XML node #7238

Closed
gopherbot opened this Issue Jan 30, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@gopherbot
Copy link

gopherbot commented Jan 30, 2014

by ceving:

What steps will reproduce the problem?
http://play.golang.org/p/qb45AYAD4U

What is the expected output?
I expect that the "struct" node defined in line 44 appears in the XML output.

What do you see instead?
I see no "struct" node. Instead I have to add a useless "x" node to
get the expected output.

Which compiler are you using (5g, 6g, 8g, gccgo)?
play.golang.org

Which operating system are you using?
play.golang.org

Which version are you using?  (run 'go version')
go1.2rc3
@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Mar 3, 2014

Comment 1:

It's not dropping "struct". It is using it to set the default name for each xml item
corresponding to the array element of type interface{}. However, your array elements are
overriding that default by setting an xml.Name. You can drop the xml.Name.
http://play.golang.org/p/VhDJlNImu-
@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Mar 3, 2014

Comment 2:

Status changed to WorkingAsIntended.

@gopherbot

This comment has been minimized.

Copy link
Author

gopherbot commented Mar 4, 2014

Comment 3 by ceving:

This means, that the xml.Name attribute of an array does not name the array but the
children. This is far from obvious that container elements do not have their own name,
but get their name by the container. But if it is intended...

@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.