29 lines
645 B
Go
29 lines
645 B
Go
package atom
|
|
|
|
import (
|
|
"encoding/xml"
|
|
"errors"
|
|
)
|
|
|
|
// TODO: Is this really correct?
|
|
type ExtensionElement struct {
|
|
Value any `xml:",innerxml"`
|
|
XMLName xml.Name
|
|
}
|
|
|
|
// NewExtensionElement creates a new ExtensionElement. It returns a
|
|
// *ExtensionElement.
|
|
func NewExtensionElement(name string, value any) *ExtensionElement {
|
|
return &ExtensionElement{XMLName: xml.Name{Local: name}, Value: value}
|
|
}
|
|
|
|
// Check checks the ExtensionElement for incompatibilities with RFC4287. It
|
|
// returns an error.
|
|
func (e *ExtensionElement) Check() error {
|
|
if e.Value == nil {
|
|
return errors.New("value element of extension element empty")
|
|
}
|
|
|
|
return nil
|
|
}
|