You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package xml
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/xml"
|
|
|
|
"git.diulo.com/mogfee/kit/encoding"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Name is the name registered for the xml codec.
|
|
|
|
const Name = "xml"
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
encoding.RegisterCodec(codec{})
|
|
|
|
}
|
|
|
|
|
|
|
|
// codec is a Codec implementation with xml.
|
|
|
|
type codec struct{}
|
|
|
|
|
|
|
|
func (codec) Marshal(v interface{}) ([]byte, error) {
|
|
|
|
return xml.Marshal(v)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (codec) Unmarshal(data []byte, v interface{}) error {
|
|
|
|
return xml.Unmarshal(data, v)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (codec) Name() string {
|
|
|
|
return Name
|
|
|
|
}
|