From ecb02113459eb176e5bf133740e0d131fe660b7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 4 Nov 2024 17:23:08 +0800 Subject: [PATCH] AnyMap -> XmlStringMap --- xml.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xml.go b/xml.go index c1b618d..97fb295 100644 --- a/xml.go +++ b/xml.go @@ -68,14 +68,14 @@ func (o *ownXml) MarshalForStringIgnoreError(input any) string { return str } -type AnyMap map[string]any +type XmlStringMap map[string]string type xmlMapEntry struct { XMLName xml.Name - Value any `xml:",chardata"` + Value string `xml:",chardata"` } -func (m *AnyMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error { +func (m *XmlStringMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error { if nil == m { return nil } @@ -95,8 +95,8 @@ func (m *AnyMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error { return e.EncodeToken(start.End()) } -func (m *AnyMap) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - *m = AnyMap{} +func (m *XmlStringMap) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + *m = XmlStringMap{} for { var e xmlMapEntry