Skip to content

Commit

Permalink
Merge pull request #82 from ArtisanCloud/develop
Browse files Browse the repository at this point in the history
fix(xml): Map2Xml []HashMap and []*HashMap
  • Loading branch information
Matrix-X authored May 10, 2023
2 parents e6f202b + cca6e72 commit 9782ad9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions object/xml.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ func Map2Xml(obj *HashMap, isSub bool) (strXML string) {
case float64:
strXML = strXML + fmt.Sprintf("<%s>%f</%s>", k, v, k)
break
case []*HashMap:
for _, subV := range v.([]*HashMap) {
strXML = strXML + fmt.Sprintf("<%s>%s</%s>", k, Map2Xml(subV, true), k)
}
break
case []HashMap:
for _, subV := range v.([]HashMap) {
strXML = strXML + fmt.Sprintf("<%s>%s</%s>", k, Map2Xml(&subV, true), k)
}
break
case *HashMap:
strXML = strXML + fmt.Sprintf("<%s>%s</%s>", k, Map2Xml(v.(*HashMap), true), k)
break
Expand Down

0 comments on commit 9782ad9

Please sign in to comment.