code: func XML(w http.ResponseWriter, r *http.Request, v interface{}) {
  	b, err := xml.Marshal(v)
  	if err != nil {
  		http.Error(w, err.Error(), http.StatusInternalServerError)
  		return
  	}
  
  	w.Header().Set("Content-Type", "application/xml; charset=utf-8")
  	if status, ok := r.Context().Value(StatusCtxKey).(int); ok {
  		w.WriteHeader(status)
  	}
  
  	// Try to find <?xml header in first 100 bytes (just in case there're some XML comments).
  	findHeaderUntil := len(b)
  	if findHeaderUntil > 100 {
  		findHeaderUntil = 100
  	}
  	if !bytes.Contains(b[:findHeaderUntil], []byte("<?xml")) {
  		// No header found. Print it out first.
  		w.Write([]byte(xml.Header))
  	}
  
  	w.Write(b)
  }
docs: // XML marshals 'v' to JSON, setting the Content-Type as application/xml. It
  // will automatically prepend a generic XML header (see encoding/xml.Header) if
  // one is not found in the first 100 bytes of 'v'.