package atom import ( "errors" "fmt" ) type ExtensionAttribute struct { Attr string `xml:",attr"` } // NewExtensionAttribute creates a new ExtensionAttribute. It returns a // *ExtensionAttribute. func NewExtensionAttribute(name, value string) *ExtensionAttribute { return &ExtensionAttribute{Attr: fmt.Sprint(name, `="`, value, `"`)} } // Check checks the ExtensionAttribute for incompatibilities with RFC4287. It // returns an error. func (e *ExtensionAttribute) Check() error { if e.Attr == "" { return errors.New("value element of extension attribute empty") } return nil }