readText reads text until the `<` character or EOF.
()
| 209 | |
| 210 | // readText reads text until the `<` character or EOF. |
| 211 | func (d *Decoder) readText() []byte { |
| 212 | d.buf.Reset() |
| 213 | |
| 214 | if d.readUntil('<') { |
| 215 | // Successful `readUntil` means we have read up to `<`, |
| 216 | // so we need to unread it for further processing and trim it from the buffer. |
| 217 | d.unreadByte('<') |
| 218 | d.buf.Remove(1) |
| 219 | } |
| 220 | |
| 221 | // Return what we've read. |
| 222 | return d.buf.Bytes() |
| 223 | } |
| 224 | |
| 225 | // readStartTag reads a start tag. |
| 226 | func (d *Decoder) readStartTag() (*StartElement, bool) { |