Hi James: > Well, that's probably what it means. XML parsers are generally pretty good at spotting errors. If you're able to reveal the source of your XML, perhaps we could find the error. Of course, that may not be much help unless you also control the source of the RSS.
[Louis] I am using YahooNews url http://news.search.yahoo.com/usns/ynsearch/categories/news_story_search_rss/index.html?p=some+keyword So I cannot control the source. Sometimes I get the error. Not all the time. > The other option to consider is that there are XML parsers around that will deal with dodgy XML. It's been too long since I've used the perl XML libs, bit there might even be a flag you can set to get them to work. [Louis] I'll have to read about this from perldoc of XML::RSS. > If you just want to catch the error, then you need to use eval. Like this: eval { # do stuff }; warn "something broke" if $@; [Louis] Do u mean eval { my $rssobj = ""; $rssobj = new XML::RSS; $url = YahooNewsUrl; $response = $browser->get($url); # assuming LWP is defined before eval if (!($response->is_success)) { # flag some error/warning; } my $temp = $response->content(); # parse the RSS content $rssobj->parse($temp); # Is the error I reported happening here ??? } warn "something broke" if $@; Cheers. -- I'm always learning something new everyday. Thanks Sluggers. -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
