idcrisis has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to parse a valid xml document using XML::RAI and see that it can identify limited number of fields that i can retrieve. How can i retrieve author or description or replycount fields from the XML document given below.
#!/usr/bin/perl use XML::RAI; my $xml=`curl -ksS "https://forums.com/rss.php?forumID=143"`; $xml =~ s/\15//g; my $feed = XML::RAI->parse($xml); for ( reverse (@{$feed->items}) ){ my $title=$_->title; my $date =$_->created ; my $date_modified; my $url =$_->link ; }
XML Format:
<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:jf="http://forums.com/rss"> <channel> <item> <title>xxxxxxxxxxxxxxxxx</title> <link>https://forums.com/thread.php</link> <description>yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy</description> <pubDate>Wed, 19 Sep 2012 20:57:16</pubDate> <jf:creationDate>Wed, 19 Sep 2012 20:57:16 </jf:creationDate> <jf:modificationDate>Wed, 19Sep2012 20:57:16 </jf:modification +Date> <jf:date>Sep 19, 2012</jf:date> <jf:author>author1</jf:author> <jf:replyCount>3</jf:replyCount> </item> </channel> </rss>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML Parser question
by tobyink (Canon) on Sep 20, 2012 at 11:22 UTC | |
|
Re: XML Parser question
by shmem (Chancellor) on Sep 20, 2012 at 15:17 UTC |