summaryrefslogtreecommitdiff
path: root/libgo/go/encoding/xml/read.go
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-09 08:19:58 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-09 08:19:58 +0000
commit2da6f72bb78de6e6ca3d387d970cb21bf36684be (patch)
tree7ca86535c5a6b99d4cc432ba5cfddabc5ee4ea16 /libgo/go/encoding/xml/read.go
parent98ea39f2b59cc0a4a0a32b095e8f0faa84fd7882 (diff)
downloadgcc-2da6f72bb78de6e6ca3d387d970cb21bf36684be.tar.gz
libgo: Update to weekly.2012-02-07.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184034 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/encoding/xml/read.go')
-rw-r--r--libgo/go/encoding/xml/read.go21
1 files changed, 12 insertions, 9 deletions
diff --git a/libgo/go/encoding/xml/read.go b/libgo/go/encoding/xml/read.go
index 871fe059cfa..bde875a0123 100644
--- a/libgo/go/encoding/xml/read.go
+++ b/libgo/go/encoding/xml/read.go
@@ -265,12 +265,13 @@ func (p *Decoder) unmarshal(val reflect.Value, start *StartElement) error {
saveData = v
case reflect.Struct:
- sv = v
- typ := sv.Type()
+ typ := v.Type()
if typ == nameType {
v.Set(reflect.ValueOf(start.Name))
break
}
+
+ sv = v
tinfo, err = getTypeInfo(typ)
if err != nil {
return err
@@ -541,19 +542,21 @@ Loop:
panic("unreachable")
}
-// Have already read a start element.
-// Read tokens until we find the end element.
-// Token is taking care of making sure the
-// end element matches the start element we saw.
-func (p *Decoder) Skip() error {
+// Skip reads tokens until it has consumed the end element
+// matching the most recent start element already consumed.
+// It recurs if it encounters a start element, so it can be used to
+// skip nested structures.
+// It returns nil if it finds an end element matching the start
+// element; otherwise it returns an error describing the problem.
+func (d *Decoder) Skip() error {
for {
- tok, err := p.Token()
+ tok, err := d.Token()
if err != nil {
return err
}
switch tok.(type) {
case StartElement:
- if err := p.Skip(); err != nil {
+ if err := d.Skip(); err != nil {
return err
}
case EndElement: