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