Hi, Can you recommend an XML parser which is faster than XML::Twig?
I need to use an XML parser that can parse the XML files chunk by chunk and which works faster (much faster) than XML::Twig, because I tried using this module but it is very slow. I tried something like the code below, but I have also tried a version that just opens the file and parses it using regular expressions, however the unelegant regexp version is 25 times faster than the one which uses XML::Twig, and it also uses less memory. If you think there is a module for parsing XML which would work faster than regular expressions, or if I can substantially improve the program which uses XML::Twig then please tell me about it. If regexp will still be faster, I will use regexp. Thanks. use XML::Twig; my $xml = 'path/to/xml/file.xml'; my $t= XML::Twig->new( twig_handlers => { Lexem => sub { my( $t, $lexem )= @_; my $id = $lexem->att( 'id' ); my $timestamp = $lexem->first_child( 'Timestamp')->text; my $lexem_text = $lexem->first_child( 'Form' )->text; my @inflected_form = $lexem->children( 'InflectedForm' ); for my $inflected_form ( @inflected_form ) { my $inflection_id = $inflected_form->first_child( 'InflectionId' )->text; my $inflection_text = $inflected_form->first_child( 'Form' )->text; } $t->purge; return 1; }, } ); $t->safe_parsefile( $xml ); $t->purge; --Octavian -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/