Standard library / encoding/xml
encoding/xml.Decoder.Skip()
Consumes tokens through the end of the current element after its start has been read. Expected stdout: 'c\n'.
Formal Syntax & Structure
go syntaxgo
func (d *Decoder) Skip() errorReturn Value
error
Nil on success; otherwise the operation error.
Working Example
Example Snippetgo
package main
import ( "encoding/xml" "fmt" "strings")
func must(e error) { if e != nil { panic(e) }}
func main() { d := xml.NewDecoder(strings.NewReader("<a><b>skip</b><c>Go</c></a>")) _, e := d.Token() must(e) _, e = d.Token() must(e) must(d.Skip()) t, e := d.Token() must(e) fmt.Println(t.(xml.StartElement).Name.Local)}