The following struct is used to marshall SAML XML elements such as OrganizationName
, OrganizationDisplayName
& OrganizationURL
.
type LocalizedName struct {
Lang string `xml:"xml lang,attr"`
Value string `xml:",chardata"`
}
The Lang
attribute is within the xml
namespace. The generated XML from the encoding/xml package includes relative namespaces:
<Organization>
<OrganizationName xmlns:_xml="xml" _xml:lang="en">name</OrganizationName>
<OrganizationDisplayName xmlns:_xml="xml" _xml:lang="en">name</OrganizationDisplayName>
<OrganizationURL xmlns:_xml="xml" _xml:lang="en">http://www.example.com/</OrganizationURL>
</Organization>
I was expecting the elements to not use relative namespaces as they seem to be considered to be insecure, although I do not understand why:
<OrganizationName xml:lang="en">name</OrganizationName>
What causes the relative namespaces to be created?