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: unclear tag conflicts when dealing with namespaces #36813

Closed
directionless opened this issue Jan 27, 2020 · 1 comment
Closed

Comments

@directionless
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.13.4 darwin/amd64

What did you do?

I'm trying to serialize some structs to xml. I'm looking for output like

<Parent>
   <Child ABool="true"></Child>
   <Child xmlns="http://schemas.example.com/childb" ABool="true"></Child>
   <ABool>true</ABool>
</Parent>

But the obvious way to do that results in main.Parent field "ChildA" with tag "" conflicts with field "ChildB" with tag ""

If I set a namespace on ChildA, it works. But I don't think I should need to.

Example in https://play.golang.org/p/vUU6C5PiWk_C

@cagedmantis
Copy link
Contributor

For asking questions about learning the language, see one of our forums: https://golang.org/wiki/Questions. We only use this issue tracker for tracking bugs. People in the forums can explain what is happening here.

@golang golang locked and limited conversation to collaborators Feb 6, 2021
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