Skip to content

Commit

Permalink
fix(xml): hashmap with tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrix-X committed May 9, 2024
1 parent 46f76d9 commit dce1335
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions object/xml.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ func Map2Xml(obj *HashMap, isSub bool) (strXML string) {
strXML = strXML + fmt.Sprintf("<%s>%f</%s>", k, v, k)
break
case []*HashMap:
strXML = strXML + fmt.Sprintf("<%s>", k)
for _, subV := range v.([]*HashMap) {
strXML = strXML + fmt.Sprintf("<%s>%s</%s>", k, Map2Xml(subV, true), k)
strXML = strXML + fmt.Sprintf("%s", Map2Xml(subV, true))
}
strXML = strXML + fmt.Sprintf("</%s>", k)
break
case []HashMap:
strXML = strXML + fmt.Sprintf("<%s>", k)
for _, subV := range v.([]HashMap) {
strXML = strXML + fmt.Sprintf("<%s>%s</%s>", k, Map2Xml(&subV, true), k)
strXML = strXML + fmt.Sprintf("%s", Map2Xml(&subV, true))
}
strXML = strXML + fmt.Sprintf("</%s>", k)
break
case *HashMap:
strXML = strXML + fmt.Sprintf("<%s>%s</%s>", k, Map2Xml(v.(*HashMap), true), k)
Expand Down

0 comments on commit dce1335

Please sign in to comment.