DreamT has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I'm mainly used to work with XML::Simple, so my XML parsing skills are what you can call "novice" ;-)
However, now I have problems since I need to process a quite large file (12.2 mb) , and XML::Simple croaked with a "killed" message. I've also tried XML::Bare, worked great on my local computer, but on the server it also croaked with "Segmentation fault".
I suspect that the file is too large for these modules to process.
So, here are my questions:
1. Do you know how I can "tweak" the modules above to optimize the performance? 2. If not, what other module can do the job? I tried XML::Parser, but frankly I didn't find a good method browse the data - I simply didn't "get" how to use it in a good way:) (I'm used to access the data in the way that XML::Simple/XML::Bare serves it)
Example data below. I want to browse each -product- to fetch -product_id- and loop over -attributes- to get the values of each -attribute- tag.
However, now I have problems since I need to process a quite large file (12.2 mb) , and XML::Simple croaked with a "killed" message. I've also tried XML::Bare, worked great on my local computer, but on the server it also croaked with "Segmentation fault".
I suspect that the file is too large for these modules to process.
So, here are my questions:
1. Do you know how I can "tweak" the modules above to optimize the performance? 2. If not, what other module can do the job? I tried XML::Parser, but frankly I didn't find a good method browse the data - I simply didn't "get" how to use it in a good way:) (I'm used to access the data in the way that XML::Simple/XML::Bare serves it)
Example data below. I want to browse each -product- to fetch -product_id- and loop over -attributes- to get the values of each -attribute- tag.
<?xml version="1.0" encoding="ISO-8859-1"?> <feed> <timestamp>Thu, 11 Sep 2014 08:58:59 +0200</timestamp> <language_product_id>sv</language_product_id> <products> <product> <product_id>ABC123</product_id> <name>My product</name> <attributes> <attribute> <group> <id>1507</id> <name>Engines</name> </group> <value> <id>301</id> <value>Generator</value> </value> </attribute> <attribute> <group> <id>1561</id> <name>Längd (i mm)</name> </group> <value> <id></id> <value>2625</value> </value> </attribute> <attribute> <group> <id>1498</id> <name>Year model</name> </group> <value> <id></id> <value>01.1994</value> </value> </attribute> <attribute> <group> <id>1518</id> <name>Year model (to)</name> </group> <value> <id></id> <value>12.1998</value> </value> </attribute> <attribute> <group> <id>12033</id> <name>Vehicle equipment</name> </group> <value> <id>12019</id> <value>Maybe</value> </value> </attribute> </attributes> <references /> </product> <product> <product_id>XYZ789</product_id> <name>My product</name> <attributes> <attribute> <group> <id>1507</id> <name>Engines</name> </group> <value> <id>301</id> <value>Generator</value> </value> </attribute> <attribute> <group> <id>1498</id> <name>Year model</name> </group> <value> <id></id> <value>01.1985</value> </value> </attribute> <attribute> <group> <id>1518</id> <name>Year model (to)</name> </group> <value> <id></id> <value>12.1992</value> </value> </attribute> </attributes> <references /> </product> </products> </feed>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Easy XML-parser that can handle large file?
by Corion (Patriarch) on Sep 11, 2014 at 07:22 UTC | |
Re: Easy XML-parser that can handle large file?
by Discipulus (Canon) on Sep 11, 2014 at 07:32 UTC | |
by Discipulus (Canon) on Sep 11, 2014 at 08:20 UTC | |
by mirod (Canon) on Sep 12, 2014 at 05:37 UTC | |
by Discipulus (Canon) on Sep 12, 2014 at 07:42 UTC | |
by mirod (Canon) on Sep 12, 2014 at 08:30 UTC | |
Re: Easy XML-parser that can handle large file? ( XML::Rules )
by Anonymous Monk on Sep 11, 2014 at 07:13 UTC | |
by choroba (Cardinal) on Sep 11, 2014 at 07:52 UTC | |
Re: Easy XML-parser that can handle large file?
by jellisii2 (Hermit) on Sep 11, 2014 at 11:51 UTC |
Back to
Seekers of Perl Wisdom