Standard library / encoding/xml
encoding/xml.Decoder.InputPos()
Reports the one-based line and column of the end of the most recently returned token. Expected stdout: '1 4\n'.
Formal Syntax & Structure
go syntaxgo
func (d *Decoder) InputPos() (line, column int)Return Value
(line, column int)
One-based line and column.
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>Go</a>")) _, e := d.Token() must(e) l, c := d.InputPos() fmt.Println(l, c)}