Standard library / encoding/xml

encoding/xml.ProcInst

Represents a processing instruction with target and instruction bytes. Expected stdout: 'test Go\n'.

Formal Syntax & Structure

go syntaxgo
type ProcInst struct {  Target string  Inst   []byte}

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("<?test Go?>"))  t, e := d.Token()  must(e)  p := t.(xml.ProcInst)  fmt.Println(p.Target, string(p.Inst))}
Go Reference