golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.88k stars 17.65k forks source link

xml how to add empty namespace xmlns="" #45381

Closed ironytr closed 3 years ago

ironytr commented 3 years ago

i just wanted add empty namespace, used quick fix Xmlns string `xml:"xmlns,attr" but not solving other problems example, int, string types.

tried xml:"* categoryId" turns out -> <categoryId xmlns="*">1001770</categoryId> yet soap api not accepting * character wants <categoryId xmlns="">1001770</categoryId>

type Authentication struct {
    Xmlns string    `xml:"xmlns,attr"  json:"-"`
    AppKey string `xml:"appKey,omitempty" json:"appKey,omitempty"`

    AppSecret string `xml:"appSecret,omitempty" json:"appSecret,omitempty"`
}

type GetSubCategoriesRequest struct {
    XMLName xml.Name `xml:"http://www.n11.com/ws/schemas GetSubCategoriesRequest"`

    Auth *Authentication `xml:"auth,omitempty" json:"auth,omitempty"`

    CategoryId int64 `xml:"* categoryId,omitempty" json:"categoryId,omitempty"` <<<<<<<-------- i need xmlns="" 
}

any help?

Originally posted by @ironytr in https://github.com/golang/go/issues/13400#issuecomment-813019271

seankhliao commented 3 years ago

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions