I'm working on an RSS reader application and running into an issue with The New York Times RSS feed. I've narrowed the issue down to the following XML (unnecessary fields omitted):
<item>
<link>https://www.nytimes.com/2017/09/25/briefing/nfl-angela-merkel-iraqi-kurdistan.html?partner=rss&emc=rss</link>
<atom:link rel="standout" href="https://www.nytimes.com/2017/09/25/briefing/nfl-angela-merkel-iraqi-kurdistan.html?partner=rss&emc=rss"/>
<pubDate>Mon, 25 Sep 2017 13:36:07 GMT</pubDate>
</item>
I'm trying to parse it into the following structure:
type item struct {
Link string `xml:"link"`
PubDate string `xml:"pubDate"`
}
When parsed, the Link field is blank. However, by deleting the atom:link field it works fine. I think the similarity in the tags names is confusing the parser. I have a go playground that demonstrates the issue, and that removing that line fixes it: https://play.golang.org/p/fUbLhSbo5K How can I work around this issue? It's not really feasible to special case it because there could be other feeds that do this too.