summaryrefslogtreecommitdiff
path: root/src/pkg/encoding/xml/read.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/encoding/xml/read.go')
-rw-r--r--src/pkg/encoding/xml/read.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/pkg/encoding/xml/read.go b/src/pkg/encoding/xml/read.go
index 344ab514e..a7a2a9655 100644
--- a/src/pkg/encoding/xml/read.go
+++ b/src/pkg/encoding/xml/read.go
@@ -263,7 +263,7 @@ func (p *Decoder) unmarshal(val reflect.Value, start *StartElement) error {
strv := finfo.value(sv)
// Look for attribute.
for _, a := range start.Attr {
- if a.Name.Local == finfo.name {
+ if a.Name.Local == finfo.name && (finfo.xmlns == "" || finfo.xmlns == a.Name.Space) {
copyValue(strv, []byte(a.Value))
break
}
@@ -441,7 +441,7 @@ func (p *Decoder) unmarshalPath(tinfo *typeInfo, sv reflect.Value, parents []str
Loop:
for i := range tinfo.fields {
finfo := &tinfo.fields[i]
- if finfo.flags&fElement == 0 || len(finfo.parents) < len(parents) {
+ if finfo.flags&fElement == 0 || len(finfo.parents) < len(parents) || finfo.xmlns != "" && finfo.xmlns != start.Name.Space {
continue
}
for j := range parents {
@@ -493,7 +493,6 @@ Loop:
return true, nil
}
}
- panic("unreachable")
}
// Skip reads tokens until it has consumed the end element
@@ -517,5 +516,4 @@ func (d *Decoder) Skip() error {
return nil
}
}
- panic("unreachable")
}