This commit is contained in:
cdle
2023-06-08 23:04:38 +08:00
parent 4f7e97a731
commit 458c22e421
3 changed files with 25 additions and 1 deletions
+21
View File
@@ -0,0 +1,21 @@
package core
import (
"github.com/clbanning/mxj"
)
func (sender *Strings) ParseXml(str string) map[string]interface{} {
m, err := mxj.NewMapXml([]byte(str))
if err != nil {
console.Error("xml解析错误:", err)
}
return m
}
func (sender *Strings) Xml(m map[string]interface{}) string {
xmlStr, err := mxj.Map(m).Xml()
if err != nil {
console.Error("xml编码错误:", err)
}
return string(xmlStr)
}