Home Download Docs Code Community
     1	// Copyright 2009 The Go Authors.  All rights reserved.
     2	// Use of this source code is governed by a BSD-style
     3	// license that can be found in the LICENSE file.
     4	
     5	// Adapted from encoding/xml/read_test.go.
     6	
     7	// Package atom defines XML data structures for an Atom feed.
     8	package atom // import "perkeep.org/pkg/importer/feed/atom"
     9	
    10	import (
    11		"encoding/xml"
    12		"time"
    13	)
    14	
    15	type Feed struct {
    16		XMLName xml.Name `xml:"feed"`
    17		Title   string   `xml:"title"`
    18		ID      string   `xml:"id"`
    19		Link    []Link   `xml:"link"`
    20		Updated TimeStr  `xml:"updated"`
    21		Author  *Person  `xml:"author"`
    22		Entry   []*Entry `xml:"entry"`
    23		XMLBase string   `xml:"base,attr"`
    24	}
    25	
    26	type Entry struct {
    27		Title     *Text   `xml:"title"`
    28		ID        string  `xml:"id"`
    29		Link      []Link  `xml:"link"`
    30		Published TimeStr `xml:"published"`
    31		Updated   TimeStr `xml:"updated"`
    32		Author    *Person `xml:"author"`
    33		Summary   *Text   `xml:"summary"`
    34		Content   *Text   `xml:"content"`
    35		XMLBase   string  `xml:"base,attr"`
    36	}
    37	
    38	type Link struct {
    39		Rel  string `xml:"rel,attr"`
    40		Href string `xml:"href,attr"`
    41		Type string `xml:"type,attr"`
    42	}
    43	
    44	type Person struct {
    45		Name     string `xml:"name"`
    46		URI      string `xml:"uri"`
    47		Email    string `xml:"email"`
    48		InnerXML string `xml:",innerxml"`
    49	}
    50	
    51	type Text struct {
    52		Type     string `xml:"type,attr"`
    53		Body     string `xml:",chardata"`
    54		InnerXML string `xml:",innerxml"`
    55	}
    56	
    57	type TimeStr string
    58	
    59	func Time(t time.Time) TimeStr {
    60		return TimeStr(t.Format("2006-01-02T15:04:05-07:00"))
    61	}
Website layout inspired by memcached.
Content by the authors.