]> Cypherpunks repositories - gostls13.git/commit
encoding/xml: Return SyntaxError for unmatched root start elements.
authorRobert Stepanek <robert.stepanek@gmail.com>
Sat, 5 Sep 2015 14:06:43 +0000 (16:06 +0200)
committerNigel Tao <nigeltao@golang.org>
Thu, 10 Sep 2015 01:18:30 +0000 (01:18 +0000)
commitbf2164390bd499145fc712194bb54290effd7e14
treef0d8c033f95e094cc447640aa4c4ce34851c20da
parentda7e9e4fa7a482a2c93ee40b601077ed85606263
encoding/xml: Return SyntaxError for unmatched root start elements.

Currently, the xml.Decoder's Token routine returns successfully for
XML input that does not properly close root start elements (and any
unclosed descendants). For example, all the following inputs

    <root>
    <root><foo>
    <root><foo></foo>

cause Token to return with nil and io.EOF, indicating a successful
parse.

This change fixes that. It leaves the semantics of RawToken intact.

Fixes #11405

Change-Id: I6f1328c410cf41e17de0a93cf357a69f12c2a9f7
Reviewed-on: https://go-review.googlesource.com/14315
Reviewed-by: Nigel Tao <nigeltao@golang.org>
src/encoding/xml/xml.go
src/encoding/xml/xml_test.go