Okay, the reason the 2nd one doesn’t work is because the feed is invalid… See:
http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fwww.ems1.com%2Fems-rss-feeds%2Fnews.xml
What’s actually breaking things is that <language> tag at the top. The RSS parser expects the <channel> tag to be the first thing there… I’ve got a fix to get around this issue.
You will need to edit rss.lua and change this block of code:
if myFeed == nil then return nil end local items = myFeed.child[1].child local i print("Number of items: " .. #items)
to
if myFeed == nil then return nil end local items for i = 1, #myFeed.child do if myFeed.child[i].name == "channel" then items = myFeed.child[i].child break; end end print("Number of items: " .. #items)
It now searched through the whole feed to look for the channel tag instead of assuming that <channel> would be the first tag in the file. Of course, this helps harden the code which is a good thing, but still at the end of the day, the feed is invalid. That service should consider making sure their feeds pass validation.
Now there are other things that fail validation. I don’t know what impact that will have on parsing things further into the feed.
I may have found another bug in the XML parser and I need to do more testing before I can produce a patch for it. This will get you going for now.
Rob