|
Clbanning |
at Jun 23, 2013 at 3:00 pm
|
⇧ |
| |
The xml.Decoder treats a ':' in the name as delimiting the namespace.
Thus, "media:content" returns
d.Space = "media"
d.Local = "content"
Here's the relevant method from go/src/pkg/encoding/xml/xml.go (line 1022f)
-
// Get name space name: name with a : stuck in the middle.
// The part before the : is the name space identifier.
func (d *Decoder) nsname() (name Name, ok bool) {
s, ok := d.name()
if !ok {
return
}
i := strings.Index(s, ":")
if i < 0 {
name.Local = s
} else {
name.Space = s[0:i]
name.Local = s[i+1:]
}
return name, true
}
On Friday, June 21, 2013 9:12:46 PM UTC-5, Emre Kazdağlı wrote:Hello,
I am trying to decode an XML document containing elements named "content"
and "media:content". I'm not sure is there is a different way of writing
names in the tag field, but the code below gives me a name conflict error
although "media:content" is in a different namespace.
http://play.golang.org/p/QUytEE8ORKRegards,
-Emre Kazdagli
--
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+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/groups/opt_out.