First implementation of an atom feed
This commit is contained in:
30
category.go
Normal file
30
category.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package atomfeed
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type Category struct {
|
||||
*CommonAttributes
|
||||
Content *Content `xml:"content"`
|
||||
Term string `xml:"term,attr"`
|
||||
Scheme URI `xml:"scheme,attr,omitempty"`
|
||||
Label string `xml:"label,attr,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Category) Check() error {
|
||||
if c.Term == "" {
|
||||
return errors.New("term attribute of category empty")
|
||||
}
|
||||
|
||||
if c.Content == nil {
|
||||
return errors.New("no content element of category")
|
||||
} else {
|
||||
if err := (*c.Content).Check(); err != nil {
|
||||
return fmt.Errorf("content element of category: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user