28 lines
604 B
Go
28 lines
604 B
Go
|
package atom
|
||
|
|
||
|
import (
|
||
|
"encoding/xml"
|
||
|
"errors"
|
||
|
)
|
||
|
|
||
|
type ExtensionAttribute struct {
|
||
|
XMLName xml.Name
|
||
|
Value string
|
||
|
}
|
||
|
|
||
|
// NewExtensionAttribute creates a new ExtensionAttribute. It returns a
|
||
|
// *ExtensionAttribute.
|
||
|
func NewExtensionAttribute(name, value string) *ExtensionAttribute {
|
||
|
return &ExtensionAttribute{XMLName: xml.Name{Local: name}, Value: value}
|
||
|
}
|
||
|
|
||
|
// Check checks the ExtensionAttribute for incompatibilities with RFC4287. It
|
||
|
// returns an error.
|
||
|
func (e *ExtensionAttribute) Check() error {
|
||
|
if e.Value == "" {
|
||
|
return errors.New("value of extension attribute empty")
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|