mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
xml: new "innerxml" tag to collect inner XML
R=r CC=golang-dev https://golang.org/cl/971041
This commit is contained in:
parent
57d9de3ac8
commit
e7b6fe3989
3 changed files with 66 additions and 13 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue