To generate XML to be used for a client, use the specified type for this.
domainInfo := types.DomainInfoType{
Info: types.DomainInfo{
Name: types.DomainInfoName{
Name: "example.se",
Hosts: types.DomainHostsAll,
},
},
}
bytes, err := Encode(
domainInfo,
ClientXMLAttributes(),
)
if err != nil {
panic(err)
}
The above code will generate the following XML.
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<info>
<domain:info xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xmlns="urn:ietf:params:xml:ns:domain-1.0">
<domain:name hosts="all">example.se</domain:name>
</domain:info>
</info>
</command>
</epp>
To unmarshal already created XML no matter the namespace or alias, use the auto genrated types. The XML listed above could be unmarshaled like this.
request := DomainInfoTypeIn{}
if err := xml.Unmarshal(inData, &request); err != nil {
panic(err)
}
fmt.Println(request.Info.Name.Name) // Prints `example.se`
All XSD schemas can be found att IANA web page. XSD files from this repository linked below.
- contact-1.0.xsd
- domain-1.0.xsd
- epp-1.0.xsd
- eppcom-1.0.xsd
- host-1.0.xsd
- secDNS-1.0.xsd
- secDNS-1.1.xsd
- RFC 5730 Extensible Provisioning Protocol (EPP)
- RFC 5731 Extensible Provisioning Protocol (EPP) Domain Name Mapping
- RFC 5732 Extensible Provisioning Protocol (EPP) Host Mapping
- RFC 5733 Extensible Provisioning Protocol (EPP) Contact Mapping
- RFC 5734 Extensible Provisioning Protocol (EPP) Transport over TCP
- RFC 5910 Domain Name System (DNS) Security Extensions Mapping for the Extensible Provisioning Protocol (EPP)