diff options
Diffstat (limited to 'libgo/go/encoding/xml/xml.go')
-rw-r--r-- | libgo/go/encoding/xml/xml.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libgo/go/encoding/xml/xml.go b/libgo/go/encoding/xml/xml.go index 45f4157..9a3b792 100644 --- a/libgo/go/encoding/xml/xml.go +++ b/libgo/go/encoding/xml/xml.go @@ -219,7 +219,7 @@ func NewDecoder(r io.Reader) *Decoder { // // Slices of bytes in the returned token data refer to the // parser's internal buffer and remain valid only until the next -// call to Token. To acquire a copy of the bytes, call CopyToken +// call to Token. To acquire a copy of the bytes, call CopyToken // or the token's Copy method. // // Token expands self-closing elements such as <br/> @@ -237,10 +237,11 @@ func NewDecoder(r io.Reader) *Decoder { // set to the URL identifying its name space when known. // If Token encounters an unrecognized name space prefix, // it uses the prefix as the Space rather than report an error. -func (d *Decoder) Token() (t Token, err error) { +func (d *Decoder) Token() (Token, error) { + var t Token + var err error if d.stk != nil && d.stk.kind == stkEOF { - err = io.EOF - return + return nil, io.EOF } if d.nextToken != nil { t = d.nextToken @@ -249,7 +250,7 @@ func (d *Decoder) Token() (t Token, err error) { if err == io.EOF && d.stk != nil && d.stk.kind != stkEOF { err = d.syntaxError("unexpected EOF") } - return + return t, err } if !d.Strict { @@ -292,7 +293,7 @@ func (d *Decoder) Token() (t Token, err error) { } t = t1 } - return + return t, err } const xmlURL = "http://www.w3.org/XML/1998/namespace" @@ -331,7 +332,7 @@ func (d *Decoder) switchToReader(r io.Reader) { } // Parsing state - stack holds old name space translations -// and the current set of open elements. The translations to pop when +// and the current set of open elements. The translations to pop when // ending a given tag are *below* it on the stack, which is // more work but forced on us by XML. type stack struct { @@ -1229,7 +1230,7 @@ func isNameString(s string) bool { // These tables were generated by cut and paste from Appendix B of // the XML spec at http://www.xml.com/axml/testaxml.htm -// and then reformatting. First corresponds to (Letter | '_' | ':') +// and then reformatting. First corresponds to (Letter | '_' | ':') // and second corresponds to NameChar. var first = &unicode.RangeTable{ |