On 17/10/15 07:16, Matt Harden wrote:
> Go implements XML namespaces, and always calls them by their URLs,
> rather than the short prefixes they are given.
>
> You have chosen two prefixes that have special meaning in XML. The
> xmlns: prefix creates a new XML namespace with the given value as its
> URL. The xml: prefix is automatically defined with a URL of
> "
http://www.w3.org/XML/1998/namespace".
>
> So by saying xmlns:attribute="val" you're creating a new namespace
> called "attribute" whose URL is "val". Avoid using xmlns as a
> namespace prefix and that attribute will work.
I provided a bad example with "val". What if I really want to
capture/re-marshal the url of a namespace declaration (for use in inner
tags)?
example:
<tag xmlns="http://...." xmlns:myns="http://...." xml:lang="en">
<myns:innertag ....>
....
</myns:innertag>
</tag>
Thanks.
>
> In the case of xml:lang="en" you can capture this by specifying the
> namespace as
http://www.w3.org/XML/1998/namespace.
>
>
http://play.golang.org/p/Qe4NoynaL3
>
>
>
> On Fri, Oct 16, 2015 at 1:53 PM Kiki Sugiaman <
ksug...@gmail.com
> <mailto:
ksug...@gmail.com>> wrote:
>
> Hi all,
>
> Specifying attribute prefix this way: `xml:"prefix:attribute,attr"`
> seems to make Unmarshal fail to capture such attribute. Not specifying
> the prefix makes Unmarshal capture the attributes just fine, but will
> cause Marshal to lose the prefix.
> How do I capture prefixed attributes without causing Marshal to
> lose the
> prefix?
>
>
http://play.golang.org/p/JhqcxN0EQf
>
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google
> Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to
golang-nuts...@googlegroups.com
> <mailto:
golang-nuts%2Bunsu...@googlegroups.com>.