Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML Parser does not takes xml namespaces into account #2

Closed
zeisss opened this issue Oct 13, 2013 · 3 comments
Closed

XML Parser does not takes xml namespaces into account #2

zeisss opened this issue Oct 13, 2013 · 3 comments

Comments

@zeisss
Copy link

zeisss commented Oct 13, 2013

Feed: http://feeds.5by5.tv/changelog

Here, the go-rss package fails to parse the link tag of the channel items. It is always empty.

package main

import (
  "fmt"
  rss "github.com/ungerik/go-rss"
)

func main() {
  feed, _ := rss.Read("http://feeds.5by5.tv/changelog")
  fmt.Printf("%v\n", feed.Item[0].Link) // This is empty!
}

I guess the xml parser gets confused because there are two link tags in that stream (snippet):

...
<item>
...
<link>http://5by5.tv/changelog/107</link>
<atom:link rel="payment" type="text/html" href="https://flattr.com/submit/auto?url=http%3A%2F%2F5by5.tv%2Fchangelog%2F107&user_id=danbenjamin"/>
</item>
...

Any idea how this could be fixed?

@ungerik
Copy link
Owner

ungerik commented Dec 17, 2013

I have added an AtomLink struct field to parse that.

@ungerik ungerik closed this as completed Dec 17, 2013
@jwiklund
Copy link

jwiklund commented Jan 1, 2014

This breaks serializing using this library since link and atom:link conflicts according the the xml package
rss.Item field "Link" with tag "link" conflicts with field "AtomLink" with tag "http://www.w3.org/2005/Atom/ link"

A quick googling didn't show an obvious solution to this, and my first idea to add a
Text string "xml:",chardata" in AtomLink wouldn't help since it looks like both link and atom:link is valid. Don't know how to solve this, so since I'm the only one with this problem for now I use a pre (this commit) fork since it works for my usecase.

@jwiklund
Copy link

jwiklund commented Jan 1, 2014

Well it was mentioned on the go-nuts list, looks like it's an bug in the xml package (http://grokbase.com/t/gg/golang-nuts/136pra4gax/go-nuts-name-conflict-while-decoding-with-package-encoding-xml).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants