From 21f6865fa61c31f192a6487d0569e06fbbdb0c23 Mon Sep 17 00:00:00 2001 From: Vabd Date: Tue, 20 Mar 2018 23:41:30 +0100 Subject: [PATCH] Bring Content next to Description + define namespace for content --- rss.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/rss.go b/rss.go index c560b3f..39fe84b 100644 --- a/rss.go +++ b/rss.go @@ -12,9 +12,10 @@ import ( // private wrapper around the RssFeed which gives us the .. xml type rssFeedXml struct { - XMLName xml.Name `xml:"rss"` - Version string `xml:"version,attr"` - Channel *RssFeed + XMLName xml.Name `xml:"rss"` + Version string `xml:"version,attr"` + ContentNamespace string `xml:"xmlns:content,attr"` + Channel *RssFeed } type RssContent struct { @@ -68,14 +69,14 @@ type RssItem struct { Title string `xml:"title"` // required Link string `xml:"link"` // required Description string `xml:"description"` // required - Author string `xml:"author,omitempty"` - Category string `xml:"category,omitempty"` - Comments string `xml:"comments,omitempty"` + Content *RssContent + Author string `xml:"author,omitempty"` + Category string `xml:"category,omitempty"` + Comments string `xml:"comments,omitempty"` Enclosure *RssEnclosure Guid string `xml:"guid,omitempty"` // Id used PubDate string `xml:"pubDate,omitempty"` // created or updated Source string `xml:"source,omitempty"` - Content *RssContent } type RssEnclosure struct { @@ -159,5 +160,9 @@ func (r *Rss) FeedXml() interface{} { // return an XML-ready object for an RssFeed object func (r *RssFeed) FeedXml() interface{} { - return &rssFeedXml{Version: "2.0", Channel: r} + return &rssFeedXml{ + Version: "2.0", + Channel: r, + ContentNamespace: "http://purl.org/rss/1.0/modules/content/", + } }