atom/icon.go

28 lines
410 B
Go

package atomfeed
import (
"errors"
"fmt"
)
type Icon struct {
*CommonAttributes
URI URI `xml:"uri"`
}
func NewIcon(uri string) *Icon {
return &Icon{URI: URI(uri)}
}
func (i *Icon) Check() error {
if i.URI == "" {
return errors.New("uri element of icon empty")
} else {
if !isValidURI(i.URI) {
return fmt.Errorf("uri attribute %v of icon not correctly formatted", i.URI)
}
}
return nil
}