coronalabs-samples / business-app-sample

Business App - Sample
78 stars 58 forks source link

Search Feed #1

Open MonMohon opened 7 years ago

MonMohon commented 7 years ago

Hi, I am very new to Corona SDK.

Can you help how to implement search Feed.

Thank You

coronarob commented 7 years ago

What do you mean by a "search Feed"?

MonMohon commented 7 years ago

I mean search function for [rss.lua]

coronarob commented 7 years ago

Sorry for being difficult, but do you want to search? The downloaded feed? Content on the server to be returned in an RSS feed?

aroldo commented 6 years ago

Hello corona,

I am trying to read news from this RSS feed "feed://www.fifa.com/worldcup/news/rss.xml". I am using the Coronal Business Business App Sample and switched from the Corona News Feed to Fifa News Feed. in order to do that I changed the following variables in the function myApp.showScreen2(event) in the main.lua to: feedName = "rss.xml feedURL = "https://www.fifa.com/worldcup/news/" By the way I could not start the URL with "feed://" because I get and error from "feed.lua" of unsupported URL !

When I try to load the RSS Feed the XML parser gives me the following error ERROR: Runtime error xml.lua:136: attempt to index field '?' (a nil value) stack traceback: xml.lua:136: in function 'ParseXmlText' xml.lua:156: in function 'loadFile' rss.lua:31: in function 'feed' feed.lua:329: in function 'processRSSFeed' feed.lua:352: in function

This is not the actual XML Parsing error because the error concatenations had a wrong parameter: so I changed from this error("XmlParser: unclosed "..stack[stack.n].name) to this ("XmlParser: unclosed "..stack[#stack].name)

and I got this XML parsing error: ERROR: Runtime error xml.lua:136: XmlParser: unclosed html stack traceback: [C]: in function 'error' xml.lua:136: in function 'ParseXmlText' xml.lua:157: in function 'loadFile' rss.lua:31: in function 'feed' feed.lua:329: in function 'processRSSFeed' feed.lua:352: in function I used Feedly, an RSS Feed Reader , that reads this site without any problem.

Sun-Wukong commented 6 years ago

Hey @aroldo, I came across these comments in the feed.lua file, regarding connecting to an RSS feed. Have you tried using a feedUrl, without "https://"? Here's the comments related to that:

-- make a quick network connection to your server.. 
-- this requires the site's DNS Name, not a URL, in other words leave off
-- the http:// and no trailing things like /index.php
aroldo commented 6 years ago

Hello Sun-Wukong,

yes I did, as a matter of fact , it is loading the RSS Feed but it is falling on the parsing. I found out the parser has a DEBUG tag, I set it to TRUE and I was able to see that it is reading all tags. the issue is with the parsing of the XML.

coronarob commented 6 years ago

Change line 151 of main.lua to:

https://forums.coronalabs.com/topic/72222-xml-parser-error/

Worked like a charm in the simulator when I tested it.

Rob

Sun-Wukong commented 6 years ago

Ty for the troubleshooting @coronarob

aroldo commented 6 years ago

Hello Sun-Wukong.

I just had to add rss.xml to feedURL = "https://www.fifa.com/worldcup/news/rss.xml"

now it works!

Sun-Wukong commented 6 years ago

Fist pumping in celebration of the fix, @aroldo. Good stuff for sure.