Skip to content

Commit

Permalink
Fix issue #35.
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Banning committed Feb 1, 2017
1 parent fe576b7 commit 20e9e58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion xml.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,13 @@ func SetAttrPrefix(s string) {
lenAttrPrefix = len(attrPrefix)
}

// 18jan17: Allows user to specify if the map keys should be in snake case instead of the default hyphenated notation.
// 18jan17: Allows user to specify if the map keys should be in snake case instead
// of the default hyphenated notation.
var snakeCaseKeys bool

// CoerceKeysToSnakeCase changes the default, false, to the specified value, b.
// Note: the attribute prefix will be a hyphen, '-', or what ever string value has
// been specified using SetAttrPrefix.
func CoerceKeysToSnakeCase(b ...bool) {
if len(b) == 1 {
snakeCaseKeys = b[0]
Expand Down Expand Up @@ -938,7 +941,11 @@ func mapToXmlIndent(doIndent bool, s *string, key string, value interface{}, pp
return nil
case nil:
// terminate the tag
if doIndent {
*s += p.padding
}
*s += "<" + key
endTag, isSimple = true, true
break
default: // handle anything - even goofy stuff
elen = 0
Expand Down
4 changes: 4 additions & 0 deletions xmlseq.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,11 @@ func mapToXmlSeqIndent(doIndent bool, s *string, key string, value interface{},
return nil
case nil:
// terminate the tag
if doIndent {
*s += p.padding
}
*s += "<" + key
endTag, isSimple = true, true
break
default: // handle anything - even goofy stuff
elen = 0
Expand Down

0 comments on commit 20e9e58

Please sign in to comment.