Golang encoding/xml.Comment.Copy() function example

package encoding/xml

Golang encoding/xml.Comment.Copy() function usage example

 func CopyToken(t Token) Token {
  switch v := t.(type) {
  case CharData:
 return v.Copy()
  case Comment:
 return v.Copy()
  case Directive:
 return v.Copy()
  case ProcInst:
 return v.Copy()
  case StartElement:
 return v.Copy()
  }
  return t
 }

Reference :

http://golang.org/pkg/encoding/xml/#Comment.Copy

Advertisement