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:
parent
3537b8643d
commit
29bd83be41
2
item.go
2
item.go
|
@ -9,7 +9,7 @@ type Item struct {
|
|||
Categories []*Category
|
||||
Comments string
|
||||
Enclosures []*Enclosure
|
||||
Guid string
|
||||
Guid *string
|
||||
PubDate string
|
||||
Source *Source
|
||||
|
||||
|
|
14
rss.go
14
rss.go
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue