update xml serialize

This commit is contained in:
白茶清欢 2024-11-04 17:13:43 +08:00
parent bebbd57b58
commit 8b8d3c3384

4
xml.go
View File

@ -72,7 +72,7 @@ type AnyMap map[string]any
type xmlMapEntry struct {
XMLName xml.Name
Value string `xml:",chardata"`
Value any `xml:",chardata"`
}
func (m *AnyMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
@ -88,7 +88,7 @@ func (m *AnyMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
return err
}
for k, v := range m {
for k, v := range *m {
_ = e.Encode(xmlMapEntry{XMLName: xml.Name{Local: k}, Value: v})
}