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
|
Categories []*Category
|
||||||
Comments string
|
Comments string
|
||||||
Enclosures []*Enclosure
|
Enclosures []*Enclosure
|
||||||
Guid string
|
Guid *string
|
||||||
PubDate string
|
PubDate string
|
||||||
Source *Source
|
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 {
|
if n = item.SelectNode(ns, "author"); n != nil {
|
||||||
i.Author = Author{}
|
|
||||||
i.Author.Name = n.GetValue()
|
i.Author.Name = n.GetValue()
|
||||||
}
|
|
||||||
if n = item.SelectNode(ns, "creator"); n != nil {
|
} else if n = item.SelectNode(ns, "creator"); n != nil {
|
||||||
i.Author = Author{ Name: n.GetValue() }
|
i.Author.Name = n.GetValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
i.Comments = item.S(ns, "comments")
|
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")
|
i.PubDate = item.S(ns, "pubDate")
|
||||||
|
|
||||||
tl = item.SelectNodes(ns, "category")
|
tl = item.SelectNodes(ns, "category")
|
||||||
|
|
Loading…
Reference in New Issue