user2598274
user2598274

Reputation: 11

How to validate and parse more than 500MB XML file in perl

Can any body help me out on how to validate and parse the 500MB file using perl.

I had try the libxml module but it only validates upto 400MB. and i also tried with XML::SAX::ParserFactory, which is giving me the Bus Error (core dumped).

I am very thankful on ur answers.

Upvotes: 1

Views: 178

Answers (2)

mirod
mirod

Reputation: 16171

You can also use XML::Twig which is designed for this. It will be slower than XML::LibXML::Reader, but you may find it more convenient.

Upvotes: 2

choroba
choroba

Reputation: 241968

I would use a more modern pull parser: XML::LibXML::Reader.

use XML::LibXML::Reader;

my $reader = XML::LibXML::Reader->new(location => "file.xml")
           or die "cannot read file.xml\n";
while ($reader->read) {
    processNode($reader);
}

sub processNode {
    ...
}

Upvotes: 4

Related Questions