diff options
author | Russ Cox <rsc@golang.org> | 2010-04-21 16:27:31 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-04-21 16:27:31 -0700 |
commit | 26634e5741a84a4893315ab76333269078faf6ec (patch) | |
tree | 5566b8d8e619953739ffc53d825d3e16613356b3 /src/pkg/xml/xml.go | |
parent | 7c298c744f5477f352fdc1d5acf01710f79e34f2 (diff) | |
download | golang-26634e5741a84a4893315ab76333269078faf6ec.tar.gz |
xml: new "innerxml" tag to collect inner XML
R=r
CC=golang-dev
http://codereview.appspot.com/971041
Diffstat (limited to 'src/pkg/xml/xml.go')
-rw-r--r-- | src/pkg/xml/xml.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pkg/xml/xml.go b/src/pkg/xml/xml.go index 3737fbec9..410b0f77c 100644 --- a/src/pkg/xml/xml.go +++ b/src/pkg/xml/xml.go @@ -165,6 +165,7 @@ type Parser struct { r io.ReadByter buf bytes.Buffer + saved *bytes.Buffer stk *stack free *stack needClose bool @@ -698,6 +699,9 @@ func (p *Parser) getc() (b byte, ok bool) { if p.err != nil { return 0, false } + if p.saved != nil { + p.saved.WriteByte(b) + } } if b == '\n' { p.line++ @@ -705,6 +709,16 @@ func (p *Parser) getc() (b byte, ok bool) { return b, true } +// Return saved offset. +// If we did ungetc (nextByte >= 0), have to back up one. +func (p *Parser) savedOffset() int { + n := p.saved.Len() + if p.nextByte >= 0 { + n-- + } + return n +} + // Must read a single byte. // If there is no byte to read, // set p.err to SyntaxError("unexpected EOF") |