1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-06 21:52:27 +08:00

序列化 xml 时添加 cdata 标签

This commit is contained in:
silenceper
2019-11-18 20:45:32 +08:00
parent 39e81b45bf
commit d7f371cb65
3 changed files with 22 additions and 11 deletions

View File

@@ -3,12 +3,12 @@ package message
//Text 文本消息
type Text struct {
CommonToken
Content string `xml:"Content"`
Content CDATA `xml:"Content"`
}
//NewText 初始化文本消息
func NewText(content string) *Text {
text := new(Text)
text.Content = content
text.Content = CDATA(content)
return text
}