Merge pull request #50 from regadas/master
Fix channel and item extensions
This commit is contained in:
commit
28a9b88c87
14
rss.go
14
rss.go
|
@ -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)
|
i.Extensions = make(map[string]map[string][]Extension)
|
||||||
for _, lv := range tl {
|
for _, lv := range item.Children {
|
||||||
getExtensions(&i.Extensions, lv)
|
getExtensions(&i.Extensions, lv)
|
||||||
}
|
}
|
||||||
|
|
||||||
ch.Items = append(ch.Items, i)
|
ch.Items = append(ch.Items, i)
|
||||||
}
|
}
|
||||||
|
|
||||||
x := node.SelectNodes(ns, ns)
|
|
||||||
ch.Extensions = make(map[string]map[string][]Extension)
|
ch.Extensions = make(map[string]map[string][]Extension)
|
||||||
for _, v := range x {
|
for _, v := range node.Children {
|
||||||
if v.Name.Space != "" {
|
|
||||||
getExtensions(&ch.Extensions, v)
|
getExtensions(&ch.Extensions, v)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
this.Channels = foundChannels
|
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) {
|
func getExtensions(extensionsX *map[string]map[string][]Extension, node *xmlx.Node) {
|
||||||
extentions := *extensionsX
|
extentions := *extensionsX
|
||||||
|
|
||||||
if node.Name.Space != "" {
|
extension, noErrors := getExtension(node)
|
||||||
extensione, noErrors := getExtension(node)
|
|
||||||
if noErrors {
|
if noErrors {
|
||||||
if len(extentions[node.Name.Space]) == 0 {
|
if len(extentions[node.Name.Space]) == 0 {
|
||||||
extentions[node.Name.Space] = make(map[string][]Extension, 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 {
|
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] = 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)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue