xml: allow text segments to end at EOF

Fixes #674.

R=adg
CC=golang-dev
https://golang.org/cl/1018042
This commit is contained in:
Russ Cox 2010-04-28 19:29:20 -07:00
parent de92199648
commit 0485ba72c3
3 changed files with 31 additions and 7 deletions

View file

@ -758,9 +758,15 @@ func (p *Parser) text(quote int, cdata bool) []byte {
p.buf.Reset()
Input:
for {
b, ok := p.mustgetc()
b, ok := p.getc()
if !ok {
return nil
if cdata {
if p.err == os.EOF {
p.err = p.syntaxError("unexpected EOF in CDATA section")
}
return nil
}
break Input
}
// <![CDATA[ section ends with ]]>.