Connecting Tech Pros Worldwide Help | Site Map

Perl and XML parsing

Newbie
 
Join Date: May 2007
Posts: 1
#1: May 23 '07
I have a fairly large perl script with many sections I've been using for years which parses some XML and inserts the data to mysql. Unfortunately the xml interpreter put the whole file into memory and parsed it and as the files are getting upwards of 500Mb now that's getting slow...so I started rewriting using XML::Parser::PerlSAX which seems to be much better..

However the problem I have is that the implementation of it is as an inline package. I can't call my already established subroutines from inside the package. Is it possible at all ?

Example of package is at http://www.xml.com/lpt/a/728

Or can this be done not as a package.. Sorry I've never worked with inline packages before so this all might seem stupid..

Regards

Bok
miller's Avatar
Moderator
 
Join Date: Oct 2006
Location: San Francisco, CA
Posts: 830
#2: May 23 '07

re: Perl and XML parsing


For XML files of that size, the best module that I've found is actually XML::Twig

http://xmltwig.com/

Unfortunately, there appears to be quite a learning curve when attempting to use any new Perl XML modules, but I believe that this one might be what you need. Give it a look.

- Miller
Reply