Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Retrieving Remote XML Data

by Spenser (Friar)
on Aug 27, 2002 at 20:00 UTC ( [id://193263]=note: print w/replies, xml ) Need Help??


in reply to Using XPath to Retrieve Remote XML Data

Since this posting, I've been playing with other alternatives to XML::XPath, some of those suggested here like XML::LibXML.  However, I'm still not getting my core problem resolved.  So, let me restate my question and ask that my original code and question be set aside for the moment.

What module or modules do I use to grab directly data from the PM Newest Node XML Generator link to be able to process it, to be able to pick out the elements that I want?  And can someone give me a strip-down sample of what the code for that task might look like?

It seems that I've worked out what to do with the data once I get it in my script's possession as a straight XML document.  I just don't understand what I need to do to get it that way from this XML generator link.  Do I need to use something like XML::Parser or some other parser module to get the data and to have it put it in a format like the one my web browser so easily created?  I'm looking for some sample code of the piece I'm missing, as well as an explanation of the concept piece I'm missing, to fill in the missing piece of my sanity.  Thanks.

-Spenser

That's Spenser, with an "s" like the detective.

Replies are listed 'Best First'.
Re: Retrieving Remote XML Data
by lestrrat (Deacon) on Aug 28, 2002 at 00:52 UTC

    What's the problem with XML::LibXML? I don't know anything about the PM XML, but you should be able to do just about anything with XML::LibXML

    ## untested code use strict; use XML::LibXML; my $parser = XML::LibXML->new(); my $doc = $parser->parse_file( 'http://www.perlmonks.org/index.pl?n +ode_id=30175' ); ## find all "Discussion" section foreach my $disc_node ( $doc->findnodes( '/NEWESTNODES/NODE[ @nodet +ype="monkdiscuss" ]' ) ) { ## do something with it... }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://193263]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-04-23 12:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found