Created
March 7, 2017 09:25
-
-
Save zhangyuchi/1d24cfbd1493fbaefb096500a4c98b26 to your computer and use it in GitHub Desktop.
xml dont escape 回车换行
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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