diff --git a/gowsdl.go b/gowsdl.go index 3f47f9c..c042107 100644 --- a/gowsdl.go +++ b/gowsdl.go @@ -240,6 +240,7 @@ func (g *GoWSDL) genTypes() ([]byte, error) { "stripns": stripns, "replaceReservedWords": replaceReservedWords, "makePublic": g.makePublicFn, + "makeFieldPublic": makePublic, "comment": comment, "removeNS": removeNS, } diff --git a/types_tmpl.go b/types_tmpl.go index 31acbea..0cdb59b 100644 --- a/types_tmpl.go +++ b/types_tmpl.go @@ -30,9 +30,9 @@ var typesTmpl = ` {{define "Attributes"}} {{range .}} {{if .Doc}} {{.Doc | comment}} {{end}} {{if not .Type}} - {{ .Name | makePublic}} {{toGoType .SimpleType.Restriction.Base}} ` + "`" + `xml:"{{.Name}},attr,omitempty"` + "`" + ` + {{ .Name | makeFieldPublic}} {{toGoType .SimpleType.Restriction.Base}} ` + "`" + `xml:"{{.Name}},attr,omitempty"` + "`" + ` {{else}} - {{ .Name | makePublic}} {{toGoType .Type}} ` + "`" + `xml:"{{.Name}},attr,omitempty"` + "`" + ` + {{ .Name | makeFieldPublic}} {{toGoType .Type}} ` + "`" + `xml:"{{.Name}},attr,omitempty"` + "`" + ` {{end}} {{end}} {{end}} @@ -70,7 +70,7 @@ var typesTmpl = ` {{if .Doc}} {{.Doc | comment}} {{"\n"}} {{end}} - {{replaceReservedWords .Name | makePublic}} {{if eq .MaxOccurs "unbounded"}}[]{{end}}{{.Type | toGoType}} ` + "`" + `xml:"{{.Name}},omitempty"` + "`" + ` {{end}} + {{replaceReservedWords .Name | makeFieldPublic}} {{if eq .MaxOccurs "unbounded"}}[]{{end}}{{.Type | toGoType}} ` + "`" + `xml:"{{.Name}},omitempty"` + "`" + ` {{end}} {{end}} {{end}} {{end}}