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: does not support namespace in encoding #5975

Closed
shivakumargn opened this issue Jul 28, 2013 · 11 comments
Closed

encoding/xml: does not support namespace in encoding #5975

shivakumargn opened this issue Jul 28, 2013 · 11 comments
Milestone

Comments

@shivakumargn
Copy link
Contributor

xml.Unmarshal() can read an xml with namespace <ns:tagname xmlns:...>

xml.Marshal() is only able to generate tagname without namespace as <tagname
xmlns:...>

>go version
go version devel +3bf9ffdcca1f Sat Jul 20 23:31:51 2013 +0200 windows/amd64

Code example:
http://play.golang.org/p/6lojzPMjov
@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 1:

This will be fixed as part of the encoding/xml cleanup (golang.org/s/go12xml).

Labels changed: added priority-later, go1.2, removed priority-triage.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 2:

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 3:

Labels changed: added feature.

@rsc
Copy link
Contributor

rsc commented Aug 14, 2013

Comment 4:

This issue was closed by revision 85f3acd.

Status changed to Fixed.

@rsc
Copy link
Contributor

rsc commented Aug 14, 2013

Comment 5:

This issue was closed by revision 56ce83f.

@rsc
Copy link
Contributor

rsc commented Aug 14, 2013

Comment 6:

This issue was closed by revision 54bdfc0.

@shivakumargn
Copy link
Contributor Author

Comment 7:

The code sample (http://play.golang.org/p/6lojzPMjov) that was not working well with xml
namespace, continue to *not* work even after the CL !

@rsc
Copy link
Contributor

rsc commented Aug 14, 2013

Comment 8:

Then there was no bug before. The generated XML is valid XML and is equivalent to yours.

@shivakumargn
Copy link
Contributor Author

Comment 9:

The bug is about:
xml with namespace --> Unmarshal into Go structure --> Marshal into xml
(output is valid xml but *without* namespace)
In the link I have provided, input:
<ns:mytag xmlns:ns="mynamespace">
    <Name>xyz</Name>
</ns:mytag>
output:
<mytag xmlns="mynamespace">
        <Name>xyz</Name>
</mytag>
Isn't this an issue?

@shivakumargn
Copy link
Contributor Author

Comment 10:

If I provide the input as:
    <ns1:mytag xmlns:ns1="http://www.mynsdefs.org/nsdefs-here-ns1">
    <ns2:Name>xyz</ns2:Name>
    </ns1:mytag>
Output is:
    <mytag xmlns="http://www.mynsdefs.org/nsdefs-here-ns1">
        <Name>xyz</Name>
    </mytag>
Isn't this an issue?
ns1 & ns2 are gone in the output. play link: http://play.golang.org/p/7V9gprqiG-

@shivakumargn
Copy link
Contributor Author

Comment 11:

I was hoping to use it for soap :)

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 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