|
|
 |
perl-xml
XPath seems slow - what am I doing wrong?
by John Elbourne - work other posts by this author
Jul 11 2001 7:09AM messages near this date
view in the new Beta List Site
RE: PerlSax to parse/search large (~350 MB) file
|
Re: XPath seems slow - what am I doing wrong?
The following code takes about 2.5 seconds of user processor time on a Sun
sparc Ultra-4, which seems a long time?
###################################################
#! /usr/local/bin/perl -w
use strict;
use FindBin;
use lib ("$FindBin::Bin/../../lib/perl5/site_perl/5.005");
use XML::XPath;
use XML::Parser;
print '' . (times)[0] . "\n";
my $xp = XML::XPath-> new(filename => 'ch1.xml');
print "abstract + reference" if $xp-> find('/BIBL');
print "abstract + full text" if $xp-> find('/BDY');
print "erratum" if $xp-> find('/ERRATUM');
print "letter" if $xp-> find('/LETTER');
print "review" if $xp-> find('/REVIEW');
print 'done: ' . (times)[0] . "\n";
###################################################
The XML file being scanned is under 3000 bytes and doesn't have a match for
any of the XPath statements (which are intended to show the presence or
otherwise of top level elements). Any ideas?
using perl version 5.005_02
using XPath version 1.04
John
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
http://listserv.ActiveState.com/mailman/listinfo/perl-xml
Thread:
John Elbourne - work
Matt Sergeant
|
|
|
 |
|