Merge Pull Request and issue #24

Turns Item.Guid field into a string pointer, so it may properly
be set to nil when applicable. Adjusts remaining code and tests
to reflect this change.
This commit is contained in:
Jim Teeuwen 2013-11-28 10:22:09 +01:00
parent 3537b8643d
commit 29bd83be41
2 changed files with 10 additions and 6 deletions

View File

@ -9,7 +9,7 @@ type Item struct {
Categories []*Category
Comments string
Enclosures []*Enclosure
Guid string
Guid *string
PubDate string
Source *Source

14
rss.go
View File

@ -144,15 +144,19 @@ func (this *Feed) readRss2(doc *xmlx.Document) (err error) {
}
if n = item.SelectNode(ns, "author"); n != nil {
i.Author = Author{}
i.Author.Name = n.GetValue()
}
if n = item.SelectNode(ns, "creator"); n != nil {
i.Author = Author{ Name: n.GetValue() }
} else if n = item.SelectNode(ns, "creator"); n != nil {
i.Author.Name = n.GetValue()
}
i.Comments = item.S(ns, "comments")
i.Guid = item.S(ns, "guid")
guid := item.S(ns, "guid")
if len(guid) > 0 {
i.Guid = &guid
}
i.PubDate = item.S(ns, "pubDate")
tl = item.SelectNodes(ns, "category")