Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
encoding/xml: failure to handle conflicting tags in different namespaces #8535
What does 'go version' print? go1.3.1 What steps reproduce the problem? Try to decode document with the same tag in multiple namespaces <example> <title>Example</title> <link>http://example.com/default<;/link> <ns:link xmlns:ns="http://www.w3.org/2005/Atom";>http://example.com/ns<;/ns:link> </example>` http://play.golang.org/p/FT56UXolGO What happened? main.Example field "Link" with tag "link" conflicts with field "AtomLink" with tag "http://www.w3.org/2005/Atom link" What should have happened instead? It should be possible to decode both tags in this document. Also, if the name-spaced tag isn't provided, the second "link" element shadows the first though it's in another namespace.
I found a workaround by creating a custom string-type with a custom unmarshal function. If anyone is interested, here it is:
I also create a gist with a unit test, if you are interested.
It seems to work and can almost be used as a drop-in replacement for any string. You just need to cast it back to a string if you want to use it.