Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

XML::Parser Question

by ruhk (Scribe)
on Jul 20, 2004 at 20:25 UTC ( [id://376078]=perlquestion: print w/replies, xml ) Need Help??

ruhk has asked for the wisdom of the Perl Monks concerning the following question:

Hello fellow monks! Im trying to parse an Atom feed using XML::Parser to just get at the <entries> however I cant figure it out, and the documentation doesnt help me. So far I have

my $p1 = new XML::Parser(Style => 'Tree'); my $tree = $p1->parse($content);
The problem is $tree is in some kind of really complicated data sctructure that I have no idea how to use. Can anyone throw me some help?

Replies are listed 'Best First'.
Re: XML::Parser Question
by TilRMan (Friar) on Jul 21, 2004 at 01:35 UTC
    Have a look at XML::Simple. It'll give you back a less complicated structure.
Re: XML::Parser Question
by murugu (Curate) on Jul 21, 2004 at 03:42 UTC

    Try XML::Parser in 'subs' mode. (i.e) Style=>'Subs'

    Then use a subroutine named 'entries' which will automatically called whenever 'entries' start tag event occurs.

    my $p1 = new XML::Parser(Style => 'Subs'); my $tree = $p1->parse($content); #####called when entries start tag occurs sub entries{ #########what ever u need############ } ######### called when entries end tag occurs sub entries_{ }
Re: XML::Parser Question
by edan (Curate) on Jul 21, 2004 at 07:06 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2024-04-23 08:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found