Skip reads tokens until it has consumed the end element matching the most recent start element already consumed. It recurs if it encounters a start element, so it can be used to skip nested structures. It returns nil if it finds an end element matching the start element; otherwise it returns an erro
()
| 674 | // It returns nil if it finds an end element matching the start |
| 675 | // element; otherwise it returns an error describing the problem. |
| 676 | func (d *Decoder) Skip() error { |
| 677 | for { |
| 678 | tok, err := d.Token() |
| 679 | if err != nil { |
| 680 | return err |
| 681 | } |
| 682 | switch tok.(type) { |
| 683 | case StartElement: |
| 684 | if err := d.Skip(); err != nil { |
| 685 | return err |
| 686 | } |
| 687 | case EndElement: |
| 688 | return nil |
| 689 | } |
| 690 | } |
| 691 | } |