github.com/cyverse/go-irodsclient@v0.13.2/irods/util/xml.go (about)

     1  package util
     2  
     3  import (
     4  	"bytes"
     5  	"encoding/xml"
     6  )
     7  
     8  // EscapeXMLSpecialChars escape special chars for XML
     9  func EscapeXMLSpecialChars(in string) string {
    10  	var buf bytes.Buffer
    11  	err := xml.EscapeText(&buf, []byte(in))
    12  	if err != nil {
    13  		return in
    14  	}
    15  
    16  	return buf.String()
    17  }