Documentation ¶
Overview ¶
The Tideland Go Library atom package implements an atom feed client.
The Atom package provides the Atom XML schema as Go types for the usage with the standard marshalling/unmarshalling. The supported format is Atom 1.0. A client allows to retrieve Atom documents.
Index ¶
- Constants
- func ComposeTime(t time.Time) string
- func Encode(w io.Writer, feed *Feed) error
- func IsNoPlainTextError(err error) bool
- func IsParsingError(err error) bool
- func IsValidationError(err error) bool
- func ParseTime(s string) (t time.Time, err error)
- type Author
- type Category
- type Contributor
- type Entry
- type Feed
- type Generator
- type Link
- type Source
- type Text
Constants ¶
const ( Version = "1.0" XMLNS = "http://www.w3.org/2005/Atom" TextType = "text" HTMLType = "html" XHTMLType = "xhtml" AlternateRel = "alternate" EnclosureRel = "enclosure" RelatedRel = "related" SelfRel = "self" ViaRel = "via" )
const ( ErrValidation = iota + 1 ErrParsing ErrNoPlainText )
Variables ¶
This section is empty.
Functions ¶
func ComposeTime ¶
ComposeTime takes a Go time and converts it into a valid Atom time string.
func IsNoPlainTextError ¶
IsNoPlainTextError checks if the error signals no plain content inside a text element.
func IsParsingError ¶
IsParsingError checks if the error signals a bad formatted value.
func IsValidationError ¶
IsValidationError checks if the error signals an invalid feed.
Types ¶
type Author ¶
type Author struct { Name string `xml:"name"` URI string `xml:"uri,omitempty"` EMail string `xml:"email,omitempty"` }
Author names the author of the feed.
type Category ¶
type Category struct { Term string `xml:"term,attr"` Scheme string `xml:"scheme,attr,omitempty"` Label string `xml:"label,attr,omitempty"` }
Category specifies a category that the feed belongs to.
type Contributor ¶
type Contributor struct {
Name string `xml:"name"`
}
Contributor names one contributor of the feed.
func (*Contributor) Validate ¶
func (c *Contributor) Validate() error
Validate checks if a feed contributor is valid.
type Entry ¶
type Entry struct { Id string `xml:"id"` Title *Text `xml:"title"` Updated string `xml:"updated"` Authors []*Author `xml:"author,omitempty"` Content *Text `xml:"content,omitempty"` Link *Link `xml:"link,omitempty"` Summary *Text `xml:"subtitle,omitempty"` Categories []*Category `xml:"category,omitempty"` Contributors []*Contributor `xml:"contributor,omitempty"` Published string `xml:"published,omitempty"` Source *Source `xml:"source,omitempty"` Rights *Text `xml:"rights,omitempty"` }
Entry defines one feed entry.
type Feed ¶
type Feed struct { XMLName string `xml:"feed"` XMLNS string `xml:"xmlns,attr"` Id string `xml:"id"` Title *Text `xml:"title"` Updated string `xml:"updated"` Authors []*Author `xml:"author,omitempty"` Link *Link `xml:"link,omitempty"` Categories []*Category `xml:"category,omitempty"` Contributors []*Contributor `xml:"contributor,omitempty"` Generator *Generator `xml:"generator,omitempty"` Icon string `xml:"icon,omitempty"` Logo string `xml:"logo,omitempty"` Rights *Text `xml:"rights,omitempty"` Subtitle *Text `xml:"subtitle,omitempty"` Entries []*Entry `xml:"entry"` }
Feed is the root element of the document.
type Generator ¶
type Generator struct { Generator string `xml:",chardata"` URI string `xml:"uri,attr,omitempty"` Version string `xml:"version,attr,omitempty"` }
Generator identifies the software used to generate the feed, for debugging and other purposes.
type Link ¶
type Link struct { HRef string `xml:"href,attr"` Rel string `xml:"rel,attr,omitempty"` Type string `xml:"type,attr,omitempty"` HRefLang string `xml:"hreflang,attr,omitempty"` Title string `xml:"title,attr,omitempty"` Length int `xml:"lenght,attr,omitempty"` }
Link identifies a related web page.
type Source ¶
type Source struct { Authors []*Author `xml:"author,omitempty"` Categories []*Category `xml:"category,omitempty"` Contributors []*Contributor `xml:"contributor,omitempty"` Generator *Generator `xml:"generator,omitempty"` Icon string `xml:"icon,omitempty"` Id string `xml:"id",omitempty` Link *Link `xml:"link,omitempty"` Logo string `xml:"logo,omitempty"` Rights *Text `xml:"rights,omitempty"` Subtitle *Text `xml:"subtitle,omitempty"` Title *Text `xml:"title,omitempty"` Updated string `xml:"updated,omitempty"` }
Source preserves the source feeds metadata if the entry is copied from one feed into another feed.