Skip to content

Instantly share code, notes, and snippets.

@zhangyuchi
Created March 7, 2017 09:25
Show Gist options
  • Save zhangyuchi/1d24cfbd1493fbaefb096500a4c98b26 to your computer and use it in GitHub Desktop.
Save zhangyuchi/1d24cfbd1493fbaefb096500a4c98b26 to your computer and use it in GitHub Desktop.
xml dont escape 回车换行
package main
import (
"encoding/xml"
"fmt"
)
type MyXML struct {
XMLName xml.Name `xml:"item"`
Content interface{} `xml:"content"`
}
func main() {
x := MyXML{Content: struct{Value string `xml:",innerxml"`}{"test&abc"}}
y, _ := xml.MarshalIndent(x, "", " ")
fmt.Println(string(y))
fmt.Println("Hello, playground")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment