readEndTag reads an end tag.
()
| 370 | |
| 371 | // readEndTag reads an end tag. |
| 372 | func (d *Decoder) readEndTag() (Name, bool) { |
| 373 | // Discard '</' |
| 374 | if !d.discard(len(endTagStart)) { |
| 375 | return Name(""), false |
| 376 | } |
| 377 | |
| 378 | name, ok := d.readNSName() |
| 379 | if !ok { |
| 380 | if d.err == nil { |
| 381 | d.setSyntaxErrorf("expected name after </") |
| 382 | } |
| 383 | return name, false |
| 384 | } |
| 385 | |
| 386 | // Skip spaces before '>' |
| 387 | if !d.skipSpaces() { |
| 388 | return name, false |
| 389 | } |
| 390 | |
| 391 | // Expect '>' |
| 392 | b, ok := d.mustReadByte() |
| 393 | if !ok { |
| 394 | return name, false |
| 395 | } |
| 396 | if b != '>' { |
| 397 | d.setSyntaxErrorf("expected '>' at the end of end element, got %q", b) |
| 398 | return name, false |
| 399 | } |
| 400 | |
| 401 | return name, true |
| 402 | } |
| 403 | |
| 404 | // readProcInst reads a processing instruction (until `?>`). |
| 405 | // |
no test coverage detected