This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
package dorm
import (
"github.com/basgys/goxml2json"
"github.com/dtapps/go-library/utils/gojson"
"strings"
)
// XmlDecodeNoError xml字符串转结构体,不报错
func XmlDecodeNoError(b []byte) map[string]interface{} {
xtj := strings.NewReader(string(b))
jtx, _ := xml2json.Convert(xtj)
var data map[string]interface{}
_ = gojson.Unmarshal(jtx.Bytes(), &data)
return data
}
// XmlEncodeNoError 结构体转json字符串,不报错
func XmlEncodeNoError(data interface{}) string {
return JsonEncodeNoError(data)