Skip to content

Commit 20e9e58

Browse files
author
Charles Banning
committed
Fix issue #35.
1 parent fe576b7 commit 20e9e58

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

xml.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,13 @@ func SetAttrPrefix(s string) {
254254
lenAttrPrefix = len(attrPrefix)
255255
}
256256

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

260261
// CoerceKeysToSnakeCase changes the default, false, to the specified value, b.
262+
// Note: the attribute prefix will be a hyphen, '-', or what ever string value has
263+
// been specified using SetAttrPrefix.
261264
func CoerceKeysToSnakeCase(b ...bool) {
262265
if len(b) == 1 {
263266
snakeCaseKeys = b[0]
@@ -938,7 +941,11 @@ func mapToXmlIndent(doIndent bool, s *string, key string, value interface{}, pp
938941
return nil
939942
case nil:
940943
// terminate the tag
944+
if doIndent {
945+
*s += p.padding
946+
}
941947
*s += "<" + key
948+
endTag, isSimple = true, true
942949
break
943950
default: // handle anything - even goofy stuff
944951
elen = 0

xmlseq.go

+4
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,11 @@ func mapToXmlSeqIndent(doIndent bool, s *string, key string, value interface{},
693693
return nil
694694
case nil:
695695
// terminate the tag
696+
if doIndent {
697+
*s += p.padding
698+
}
696699
*s += "<" + key
700+
endTag, isSimple = true, true
697701
break
698702
default: // handle anything - even goofy stuff
699703
elen = 0

0 commit comments

Comments
 (0)