Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Parsing Item Tag from RSS feed

by mr_p (Scribe)
on Jul 12, 2010 at 19:47 UTC ( #849091=note: print w/replies, xml ) Need Help??


in reply to Re: Parsing Item Tag from RSS feed
in thread Parsing Item Tag from RSS feed

can you look at my code and tell me why the Xpath is not working in my code? Why I get the error message? Thanks for your help.

Replies are listed 'Best First'.
Re^3: Parsing Item Tag from RSS feed
by Corion (Pope) on Jul 12, 2010 at 20:13 UTC

    You are making things up that do not at all match any kind of documentation. That's not how programming works.

    The following code works for me, and all I needed to do was to read the documentation of XML::LibXML.

    #!/usr/bin/perl -w use strict; use warnings; use XML::LibXML; my $html_link = "http://rss.news.yahoo.com/rss/topstories"; my $dom = XML::LibXML->load_xml(location => $html_link); my $xp = XML::LibXML::XPathContext->new($dom); my @nodes = $xp->findnodes("/rss/channel/item"); print $_->toString for @nodes;

    As you haven't told us why you use XML::RSS::LibXML, I have removed it from the code.

      I was using RSS because I already have file loaded through it for parsing $item->{link} from it.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://849091]
help
Chatterbox?
[Discipulus]: choroba i'm considering to add some connection checking to your CB tk program: something like..
[Discipulus]: i got also a parser error, but once
[KurtZ]: Code Tags
[KurtZ]: ?
[choroba]: <code>...</code>
[choroba]: Discipulus: Yes, all get calls should be wrapped in a Try::Tiny
[choroba]: you can just create a ticket :)
[Discipulus]: Ah! is i'll have some fre4e time i'll try try::tiny

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2017-07-24 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (349 votes). Check out past polls.