Forum Moderators: coopster & phranque

Message Too Old, No Replies

Parse XML/RSS with perl

         

Monus

10:18 am on Aug 25, 2006 (gmt 0)

10+ Year Member



I need to parge XML/RSS feeds with Perl. After looking at cpan for the right module and found so many pargers I don't know what for parger to use.

The parger need to be very flexible, good working and easy to use. Can some with experiences in parging XML tell me what for Perl module he use.

rocknbil

6:13 pm on Aug 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For parsing most XML feeds and shipping results, I've found XML:Simple works fine. You will also want to use Data::Dumper for your initial setup of the feeds - this allows you to dump the whole parsed data structure to the screen to get at the specific elements you want to use. Once you're set up, you can comment out use: Data:Dumper.

I don't believe this link will be deleted, it's a terse and complete tutorial on using XML:Simple to build and parse XML.

[builder.com.com...]

IanKelley

10:10 pm on Sep 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you are able to work with regular expressions you're better off creating your own parser for each feed.

A regular expression with the flexibiltiy to parse many simialr feeds is also an option.

The reason being that if your script ever gets to the point where it's handling a large amount of traffic, external modules are far too inefficient.

This actually applies to all perl modules. Despite the fact that the perl community is obsessed with using modules the simple fact is that they are inefficient by nature.

They make programming easier but they will cost you all kinds of money in hardware when you need to scale.