Merge pull request #50 from regadas/master

Fix channel and item extensions
This commit is contained in:
Jim Teeuwen 2015-03-27 12:29:10 +01:00
commit 28a9b88c87
1 changed files with 11 additions and 17 deletions

14
rss.go
View File

@ -198,22 +198,18 @@ func (this *Feed) readRss2(doc *xmlx.Document) (err error) {
}
}
tl = item.SelectNodes(ns, ns)
i.Extensions = make(map[string]map[string][]Extension)
for _, lv := range tl {
for _, lv := range item.Children {
getExtensions(&i.Extensions, lv)
}
ch.Items = append(ch.Items, i)
}
x := node.SelectNodes(ns, ns)
ch.Extensions = make(map[string]map[string][]Extension)
for _, v := range x {
if v.Name.Space != "" {
for _, v := range node.Children {
getExtensions(&ch.Extensions, v)
}
}
}
this.Channels = foundChannels
@ -223,8 +219,7 @@ func (this *Feed) readRss2(doc *xmlx.Document) (err error) {
func getExtensions(extensionsX *map[string]map[string][]Extension, node *xmlx.Node) {
extentions := *extensionsX
if node.Name.Space != "" {
extensione, noErrors := getExtension(node)
extension, noErrors := getExtension(node)
if noErrors {
if len(extentions[node.Name.Space]) == 0 {
extentions[node.Name.Space] = make(map[string][]Extension, 0)
@ -232,8 +227,7 @@ func getExtensions(extensionsX *map[string]map[string][]Extension, node *xmlx.No
if len(extentions[node.Name.Space][node.Name.Local]) == 0 {
extentions[node.Name.Space][node.Name.Local] = make([]Extension, 0)
}
extentions[node.Name.Space][node.Name.Local] = append(extentions[node.Name.Space][node.Name.Local], extensione)
}
extentions[node.Name.Space][node.Name.Local] = append(extentions[node.Name.Space][node.Name.Local], extension)
}
}