First implementation of an atom feed
This commit is contained in:
28
person.go
Normal file
28
person.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package atomfeed
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type Person struct {
|
||||
*CommonAttributes
|
||||
Name string `xml:"name"`
|
||||
URI URI `xml:"uri,omitempty"`
|
||||
Email EmailAddress `xml:"email,omitempty"`
|
||||
Extensions []*ExtensionElement `xml:",any"`
|
||||
}
|
||||
|
||||
func (p *Person) Check() error {
|
||||
if p.Name == "" {
|
||||
return errors.New("name element of person element empty")
|
||||
}
|
||||
|
||||
for i, e := range p.Extensions {
|
||||
if err := e.Check(); err != nil {
|
||||
return fmt.Errorf("extension element %v of person %v: %v", i, p.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user