Skip to content

Commit

Permalink
Merge pull request #108 from ArtisanCloud/develop
Browse files Browse the repository at this point in the history
fix(xml): hashmap with tag
  • Loading branch information
Matrix-X authored May 9, 2024
2 parents b3e06ae + dce1335 commit c18c3cf
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 c18c3cf

Please sign in to comment.