Standard library / encoding/xml

encoding/xml.ProcInst.Copy()

Copies processing instruction data, including its Inst byte slice. Expected stdout: 'test Go\n'.

Formal Syntax & Structure

go syntaxgo
func (p ProcInst) Copy() ProcInst

Return Value

ProcInst

Independent processing-instruction copy.

Working Example

Example Snippetgo
package main
import (  "encoding/xml"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}
func main() {  v := xml.ProcInst{Target: "test", Inst: []byte("Go")}  c := v.Copy()  v.Inst[0] = 88  fmt.Println(c.Target, string(c.Inst))}
Go Reference