Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Go
Posted by: matias s..
Added: Mar 7, 2019 2:17 PM
Views: 36
Tags: go golang xml
Convert string to XML without escaping. Ex. <xmltag>data</xmltag>
  1.  
  2. func sendXML((w http.ResponseWriter, r *http.Request) {
  3. stringXML := "<xmltag>data</xmltag>"
  4. js := []byte(xml.Header + stringXML)
  5. w.Header().Set("Content-Type", "application/xml")
  6. w.Write(js)
  7. }
Comments disabled