Remove duplicate namespace check

This commit is contained in:
regadas 2014-11-25 11:40:44 +00:00
parent 750ceec0f2
commit 9c087ed4e8
1 changed files with 9 additions and 13 deletions

8
rss.go
View File

@ -208,10 +208,8 @@ func (this *Feed) readRss2(doc *xmlx.Document) (err error) {
ch.Extensions = make(map[string]map[string][]Extension) ch.Extensions = make(map[string]map[string][]Extension)
for _, v := range node.Children { for _, v := range node.Children {
if v.Name.Space != "" {
getExtensions(&ch.Extensions, v) getExtensions(&ch.Extensions, v)
} }
}
} }
this.Channels = foundChannels this.Channels = foundChannels
@ -221,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)
@ -230,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)
}
} }
} }