jasons 02/05/06 23:24:32
Modified: targets/xerces-p domcount.html domcreate.html domprint.html
sax2count.html saxcount.html
Log:
updated versions
Revision Changes Path
1.8 +53 -14 xml-site/targets/xerces-p/domcount.html
Index: domcount.html
===================================================================
RCS file: /home/cvs/xml-site/targets/xerces-p/domcount.html,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- domcount.html 9 Jul 2001 05:29:42 -0000 1.7
+++ domcount.html 7 May 2002 06:24:32 -0000 1.8
@@ -15,40 +15,79 @@
<DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="4"
width="464"><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0"
height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD
bgcolor="#0086b2" height="1" width="462"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="462"></TD><TD bgcolor="#0086b2"
height="1" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD
bgcolor="#0086b2" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"
width="462"><FONT size="-1"><PRE>
use strict;
use XML::Xerces;
-use Getopt::Std;
-
+use Getopt::Long;
+use Benchmark;
+use vars qw(%OPTIONS);
#
# Read and validate command line args
#
-my $USAGE = "USAGE: $0 [-v][-n] file\n";
+my $USAGE = <<EOU;
+USAGE: $0 [-v=xxx][-n] file
+Options:
+ -v=xxx Validation scheme [always | never | auto*]
+ -n Enable namespace processing. Defaults to off.
+ -s Enable schema processing. Defaults to off.
+
+ * = Default if not provided explicitly
+
+EOU
+my $VERSION = q[$Id: domcount.html,v 1.8 2002/05/07 06:24:32 jasons Exp $ ];
+
+my $rc = GetOptions(\%OPTIONS,
+ 'v=s',
+ 'n',
+ 's');
+
+die $USAGE unless $rc;
-getopts ('vn') and ($#ARGV == 0) or die "$USAGE";
--f $ARGV[0] or die "File '$ARGV[0]' does not exist!\n";
+die $USAGE unless scalar @ARGV;
-my $validate = $::opt_v;
-my $namespace = $::opt_n;
my $file = $ARGV[0];
+-f $file or die "File '$file' does not exist!\n";
+
+my $namespace = $OPTIONS{n} || 0;
+my $schema = $OPTIONS{s} || 0;
+my $validate = $OPTIONS{v} || 'auto';
+
+if (uc($validate) eq 'ALWAYS') {
+ $validate = $XML::Xerces::DOMParser::Val_Always;
+} elsif (uc($validate) eq 'NEVER') {
+ $validate = $XML::Xerces::DOMParser::Val_Never;
+} elsif (uc($validate) eq 'AUTO') {
+ $validate = $XML::Xerces::DOMParser::Val_Auto;
+} else {
+ die("Unknown value for -v: $validate\n$USAGE");
+}
+
#
# Count the nodes
#
my $parser = XML::Xerces::DOMParser->new();
-$parser->setDoValidation ($validate);
+$parser->setValidationScheme ($validate);
$parser->setDoNamespaces ($namespace);
-my $error_handler = new XML::Xerces::perlErrorHandler;
-$error_handler->setWarningFunction(\&XML::Xerces::warning);
-$error_handler->setErrorFunction(\&XML::Xerces::error);
-$error_handler->setFatalErrorFunction(\&XML::Xerces::fatal_error);
+$parser->setCreateEntityReferenceNodes(1);
+$parser->setDoSchema ($schema);
+
+my $error_handler = XML::Xerces::PerlErrorHandler->new();
$parser->setErrorHandler($error_handler);
-$parser->parse (XML::Xerces::LocalFileInputSource->new($file));
+my $t0 = new Benchmark;
+eval {
+ $parser->parse ($file);
+};
+Xerces::error($@) if ($@);
+
my $doc = $parser->getDocument ();
my $element_count =
$doc->getElementsByTagName("*")->getLength();
+my $t1 = new Benchmark;
+my $td = timediff($t1, $t0);
-print "$file: ($element_count elems)\n";
+print STDOUT "$file: duration: ", timestr($td), "\n";
+print STDOUT "\t($element_count elems)\n";
</PRE></FONT></TD><TD bgcolor="#0086b2" width="1"><IMG border="0" height="1"
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD
bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2"
height="1" width="462"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="462"></TD><TD bgcolor="#0086b2"
height="1" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></DIV>
</TD></TR></TABLE></TD></TR></TABLE><BR><TABLE border="0" cellpadding="0"
cellspacing="0" width="620"><TR><TD bgcolor="#0086b2"><IMG height="1"
src="images/dot.gif" width="1"></TD></TR><TR><TD align="center"><FONT
color="#0086b2" size="-1"><I>
Copyright © 2001 The Apache Software Foundation.
1.7 +20 -3 xml-site/targets/xerces-p/domcreate.html
Index: domcreate.html
===================================================================
RCS file: /home/cvs/xml-site/targets/xerces-p/domcreate.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- domcreate.html 9 Jul 2001 05:29:42 -0000 1.6
+++ domcreate.html 7 May 2002 06:24:32 -0000 1.7
@@ -22,10 +22,13 @@
# create a document
#
-my $doc = XML::Xerces::DOM_Document::createDocument ();
-my $root = $doc->createElement ("contributors");
+my $impl = XML::Xerces::DOM_DOMImplementation::getImplementation();
+my $dt = eval{$impl->createDocumentType('contributors', '',
'contributors.dtd')};
+error($@) if $@;
+my $doc = eval{$impl->createDocument('contributors', 'contributors',$dt)};
+error($@) if $@;
-$doc->appendChild ($root);
+my $root = $doc->getDocumentElement();
$root->appendChild(CreatePerson(
$doc,
@@ -87,6 +90,20 @@
$person->appendChild ($emailNode);
}
+
+sub error {
+ my $error = shift;
+ print STDERR "Error in eval: ";
+ if (ref $error) {
+ print STDERR "msg: ", $error->getMessage();
+ if (ref $error eq 'XML::Xerces::DOM_DOMException') {
+ print STDERR "\n\tcode: ", $error->{code};
+ }
+ print STDERR "\n";
+ } else {
+ print STDERR $error;
+ }
+}
</PRE></FONT></TD><TD bgcolor="#0086b2" width="1"><IMG border="0" height="1"
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD
bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2"
height="1" width="462"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="462"></TD><TD bgcolor="#0086b2"
height="1" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></DIV>
</TD></TR></TABLE></TD></TR></TABLE><BR><TABLE border="0" cellpadding="0"
cellspacing="0" width="620"><TR><TD bgcolor="#0086b2"><IMG height="1"
src="images/dot.gif" width="1"></TD></TR><TR><TD align="center"><FONT
color="#0086b2" size="-1"><I>
Copyright © 2001 The Apache Software Foundation.
1.7 +50 -12 xml-site/targets/xerces-p/domprint.html
Index: domprint.html
===================================================================
RCS file: /home/cvs/xml-site/targets/xerces-p/domprint.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- domprint.html 9 Jul 2001 05:29:43 -0000 1.6
+++ domprint.html 7 May 2002 06:24:32 -0000 1.7
@@ -14,40 +14,78 @@
<IMG border="0" height="14" hspace="0" src="resources/close.gif" vspace="0"
width="120"><BR></TD><TD align="left" valign="top" width="500"><TABLE
border="0" cellpadding="3" cellspacing="0"><TR><TD>
<DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="4"
width="464"><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0"
height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD
bgcolor="#0086b2" height="1" width="462"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="462"></TD><TD bgcolor="#0086b2"
height="1" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD
bgcolor="#0086b2" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"
width="462"><FONT size="-1"><PRE>
use strict;
-
+# use blib;
use XML::Xerces;
use XML::Xerces::DOMParse;
-use Getopt::Std;
+use Getopt::Long;
+use vars qw();
#
# Read and validate command line args
#
-my $USAGE = "USAGE: $0 [-v][-n] file\n";
+my $USAGE = <<EOU;
+USAGE: $0 [-v=xxx][-n] file
+Options:
+ -v=xxx Validation scheme [always | never | auto*]
+ -n Enable namespace processing. Defaults to off.
+ -s Enable schema processing. Defaults to off.
+
+ * = Default if not provided explicitly
+
+EOU
+my $VERSION = q[$Id: domprint.html,v 1.7 2002/05/07 06:24:32 jasons Exp $];
+my %OPTIONS;
+my $rc = GetOptions(\%OPTIONS,
+ 'v=s',
+ 'n',
+ 's');
+
+die $USAGE unless $rc;
-getopts ('vn') and ($#ARGV == 0) or die "$USAGE";
--f $ARGV[0] or die "File '$ARGV[0]' does not exist!\n";
+die $USAGE unless scalar @ARGV;
-my $validate = $::opt_v;
-my $namespace = $::opt_n;
my $file = $ARGV[0];
+-f $file or die "File '$file' does not exist!\n";
+my $namespace = $OPTIONS{n} || 0;
+my $schema = $OPTIONS{s} || 0;
+my $validate = $OPTIONS{v} || 'auto';
+
+if (uc($validate) eq 'ALWAYS') {
+ $validate = $XML::Xerces::DOMParser::Val_Always;
+} elsif (uc($validate) eq 'NEVER') {
+ $validate = $XML::Xerces::DOMParser::Val_Never;
+} elsif (uc($validate) eq 'AUTO') {
+ $validate = $XML::Xerces::DOMParser::Val_Auto;
+} else {
+ die("Unknown value for -v: $validate\n$USAGE");
+}
#
# Parse and print
#
-my $file = $ARGV[0];
my $parser = XML::Xerces::DOMParser->new();
+$parser->setValidationScheme ($validate);
$parser->setDoNamespaces ($namespace);
-$parser->setDoValidation ($validate);
-$parser->parse (XML::Xerces::LocalFileInputSource->new($file));
-my $doc = $parser->getDocument ();
+$parser->setCreateEntityReferenceNodes(1);
+$parser->setDoSchema ($schema);
+
+my $ERROR_HANDLER = XML::Xerces::PerlErrorHandler->new();
+$parser->setErrorHandler($ERROR_HANDLER);
+eval {
+ $parser->parse (XML::Xerces::LocalFileInputSource->new($file));
+};
+XML::Xerces::error($@) if ($@);
+
+my $doc = $parser->getDocument();
XML::Xerces::DOMParse::unformat ($doc);
XML::Xerces::DOMParse::format ($doc);
XML::Xerces::DOMParse::print (\*STDOUT, $doc);
- </PRE></FONT></TD><TD bgcolor="#0086b2" width="1"><IMG border="0"
height="1" hspace="0" src="resources/void.gif" vspace="0"
width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG
border="0" height="1" hspace="0" src="resources/void.gif" vspace="0"
width="1"></TD><TD bgcolor="#0086b2" height="1" width="462"><IMG border="0"
height="1" hspace="0" src="resources/void.gif" vspace="0" width="462"></TD><TD
bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></DIV>
+exit(0);
+</PRE></FONT></TD><TD bgcolor="#0086b2" width="1"><IMG border="0" height="1"
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD
bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2"
height="1" width="462"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="462"></TD><TD bgcolor="#0086b2"
height="1" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></DIV>
</TD></TR></TABLE></TD></TR></TABLE><BR><TABLE border="0" cellpadding="0"
cellspacing="0" width="620"><TR><TD bgcolor="#0086b2"><IMG height="1"
src="images/dot.gif" width="1"></TD></TR><TR><TD align="center"><FONT
color="#0086b2" size="-1"><I>
Copyright © 2001 The Apache Software Foundation.
All Rights Reserved.
1.3 +71 -11 xml-site/targets/xerces-p/sax2count.html
Index: sax2count.html
===================================================================
RCS file: /home/cvs/xml-site/targets/xerces-p/sax2count.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sax2count.html 9 Jul 2001 05:29:43 -0000 1.2
+++ sax2count.html 7 May 2002 06:24:32 -0000 1.3
@@ -14,22 +14,53 @@
<IMG border="0" height="14" hspace="0" src="resources/close.gif" vspace="0"
width="120"><BR></TD><TD align="left" valign="top" width="500"><TABLE
border="0" cellpadding="3" cellspacing="0"><TR><TD>
<DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="4"
width="464"><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0"
height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD
bgcolor="#0086b2" height="1" width="462"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="462"></TD><TD bgcolor="#0086b2"
height="1" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD
bgcolor="#0086b2" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"
width="462"><FONT size="-1"><PRE>
use strict;
+# use blib;
use XML::Xerces;
-use Getopt::Std;
+use Getopt::Long;
use vars qw($opt_v $opt_n);
use Benchmark;
#
# Read and validate command line args
#
-my $USAGE = "USAGE: $0 [-v][-n] file\n";
+my $USAGE = <<EOU;
+USAGE: $0 [-v=xxx][-n] file
+Options:
+ -v=xxx Validation scheme [always | never | auto*]
+ -n Enable namespace processing. Defaults to off.
+ -s Enable schema processing. Defaults to off.
+
+ * = Default if not provided explicitly
+
+EOU
+my $VERSION = q[$Id: sax2count.html,v 1.3 2002/05/07 06:24:32 jasons Exp $ ];
+
+my %OPTIONS;
+my $rc = GetOptions(\%OPTIONS,
+ 'v=s',
+ 'n',
+ 's');
-getopts ('vn') && ($#ARGV == 0) or die "$USAGE";
--f $ARGV[0] or die "File '$ARGV[0]' does not exist!\n";
+die $USAGE unless $rc;
+
+die $USAGE unless scalar @ARGV;
-my $validate = $opt_v || 0;
-my $namespace = $opt_n || 0;
my $file = $ARGV[0];
+-f $file or die "File '$file' does not exist!\n";
+
+my $namespace = $OPTIONS{n} || 0;
+my $schema = $OPTIONS{s} || 0;
+my $validate = $OPTIONS{v} || 'auto';
+
+if (uc($validate) eq 'ALWAYS') {
+ $validate = $XML::Xerces::SAX2XMLReader::Val_Always;
+} elsif (uc($validate) eq 'NEVER') {
+ $validate = $XML::Xerces::SAX2XMLReader::Val_Never;
+} elsif (uc($validate) eq 'AUTO') {
+ $validate = $XML::Xerces::SAX2XMLReader::Val_Auto;
+} else {
+ die("Unknown value for -v: $validate\n$USAGE");
+}
#
# Count the nodes
@@ -41,9 +72,12 @@
@ISA = qw(XML::Xerces::PerlContentHandler);
sub start_element {
- my $self = shift;
+ my ($self,$uri,$localname,$qname,$attrs) = @_;
$self->{elements}++;
- $self->{attrs} = 0;
+ $self->{attrs} += $attrs->getLength;
+}
+sub end_element {
+ my ($self,$uri,$localname,$qname) = @_;
}
sub characters {
my ($self,$str,$len) = @_;
@@ -56,16 +90,42 @@
package main;
my $parser = XML::Xerces::XMLReaderFactory::createXMLReader();
-$parser->setFeature("http://xml.org/sax/features/namespaces",
$namespace);
-$parser->setFeature("http://xml.org/sax/features/validation",
$validate);
+eval {
+ $parser->setFeature("http://xml.org/sax/features/namespaces",
$namespace);
+ if ($validate eq $XML::Xerces::SAX2XMLReader::Val_Auto) {
+
$parser->setFeature("http://xml.org/sax/features/validation", 1);
+
$parser->setFeature("http://apache.org/xml/features/validation/dynamic",
1);
+ } elsif ($validate eq $XML::Xerces::SAX2XMLReader::Val_Never) {
+
$parser->setFeature("http://xml.org/sax/features/validation", 0);
+ } elsif ($validate eq $XML::Xerces::SAX2XMLReader::Val_Always) {
+
$parser->setFeature("http://xml.org/sax/features/validation", 1);
+
$parser->setFeature("http://apache.org/xml/features/validation/dynamic",
0);
+ }
+
$parser->setFeature("http://apache.org/xml/features/validation/schema",
$schema);
+};
+if ($@) {
+ if (ref $@) {
+ die [EMAIL PROTECTED]>getMessage();
+ } else {
+ die $@;
+ }
+}
my $error_handler = XML::Xerces::PerlErrorHandler->new();
$parser->setErrorHandler($error_handler);
my $CONTENT_HANDLER = MyContentHandler->new();
$parser->setContentHandler($CONTENT_HANDLER);
+$CONTENT_HANDLER->{elements} = 0;
+$CONTENT_HANDLER->{attrs} = 0;
+$CONTENT_HANDLER->{ws} = 0;
+$CONTENT_HANDLER->{chars} = 0;
my $t0 = new Benchmark;
-$parser->parse (XML::Xerces::LocalFileInputSource->new($file));
+eval {
+ $parser->parse (XML::Xerces::LocalFileInputSource->new($file));
+};
+XML::Xerces::error($@) if ($@);
+
my $t1 = new Benchmark;
my $td = timediff($t1, $t0);
1.3 +53 -12 xml-site/targets/xerces-p/saxcount.html
Index: saxcount.html
===================================================================
RCS file: /home/cvs/xml-site/targets/xerces-p/saxcount.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- saxcount.html 9 Jul 2001 05:29:43 -0000 1.2
+++ saxcount.html 7 May 2002 06:24:32 -0000 1.3
@@ -14,30 +14,62 @@
<IMG border="0" height="14" hspace="0" src="resources/close.gif" vspace="0"
width="120"><BR></TD><TD align="left" valign="top" width="500"><TABLE
border="0" cellpadding="3" cellspacing="0"><TR><TD>
<DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="4"
width="464"><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0"
height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD
bgcolor="#0086b2" height="1" width="462"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="462"></TD><TD bgcolor="#0086b2"
height="1" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD
bgcolor="#0086b2" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff"
width="462"><FONT size="-1"><PRE>
use strict;
+# use blib;
use XML::Xerces;
-use Getopt::Std;
+use Getopt::Long;
use vars qw($opt_v $opt_n);
use Benchmark;
#
# Read and validate command line args
#
-my $USAGE = "USAGE: $0 [-v][-n] file\n";
+my $USAGE = <<EOU;
+USAGE: $0 [-v=xxx][-n] file
+Options:
+ -v=xxx Validation scheme [always | never | auto*]
+ -n Enable namespace processing. Defaults to off.
+ -s Enable schema processing. Defaults to off.
+
+ * = Default if not provided explicitly
+
+EOU
+
+my $VERSION = q[$Id: saxcount.html,v 1.3 2002/05/07 06:24:32 jasons Exp $ ];
+my %OPTIONS;
+my $rc = GetOptions(\%OPTIONS,
+ 'v=s',
+ 'n',
+ 's');
-getopts ('vn') && ($#ARGV == 0) or die "$USAGE";
--f $ARGV[0] or die "File '$ARGV[0]' does not exist!\n";
+die $USAGE unless $rc;
+
+die $USAGE unless scalar @ARGV;
-my $validate = $opt_v || 0;
-my $namespace = $opt_n || 0;
my $file = $ARGV[0];
+-f $file or die "File '$file' does not exist!\n";
+
+my $namespace = $OPTIONS{n} || 0;
+my $schema = $OPTIONS{s} || 0;
+my $validate = $OPTIONS{v} || 'auto';
+
+if (uc($validate) eq 'ALWAYS') {
+ $validate = $XML::Xerces::SAXParser::Val_Always;
+} elsif (uc($validate) eq 'NEVER') {
+ $validate = $XML::Xerces::SAXParser::Val_Never;
+} elsif (uc($validate) eq 'AUTO') {
+ $validate = $XML::Xerces::SAXParser::Val_Auto;
+} else {
+ die("Unknown value for -v: $validate\n$USAGE");
+}
#
# Count the nodes
#
my $parser = XML::Xerces::SAXParser->new();
-$parser->setDoValidation ($validate);
+$parser->setValidationScheme ($validate);
$parser->setDoNamespaces ($namespace);
+$parser->setDoSchema ($schema);
my $ERROR_HANDLER = XML::Xerces::PerlErrorHandler->new();
$parser->setErrorHandler($ERROR_HANDLER);
@@ -47,9 +79,12 @@
@ISA = qw(XML::Xerces::PerlDocumentHandler);
sub start_element {
- my $self = shift;
+ my ($self,$name,$attrs) = @_;
$self->{elements}++;
- $self->{attrs} = 0;
+ $self->{attrs} += $attrs->getLength();
+}
+sub end_element {
+ my ($self,$name) = @_;
}
sub characters {
my ($self,$str,$len) = @_;
@@ -64,8 +99,16 @@
my $DOCUMENT_HANDLER = MyDocumentHandler->new();
$parser->setDocumentHandler($DOCUMENT_HANDLER);
+$DOCUMENT_HANDLER->{elements} = 0;
+$DOCUMENT_HANDLER->{attrs} = 0;
+$DOCUMENT_HANDLER->{ws} = 0;
+$DOCUMENT_HANDLER->{chars} = 0;
my $t0 = new Benchmark;
-$parser->parse (XML::Xerces::LocalFileInputSource->new($file));
+eval {
+ $parser->parse (XML::Xerces::LocalFileInputSource->new($file));
+};
+XML::Xerces::error($@) if ($@);
+
my $t1 = new Benchmark;
my $td = timediff($t1, $t0);
@@ -74,8 +117,6 @@
print "attrs: ", $DOCUMENT_HANDLER->{attrs}, "\n";
print "whitespace: ", $DOCUMENT_HANDLER->{ws}, "\n";
print "characters: ", $DOCUMENT_HANDLER->{chars},
"\n";
-
-
</PRE></FONT></TD><TD bgcolor="#0086b2" width="1"><IMG border="0" height="1"
hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD
bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2"
height="1" width="462"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="462"></TD><TD bgcolor="#0086b2"
height="1" width="1"><IMG border="0" height="1" hspace="0"
src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></DIV>
</TD></TR></TABLE></TD></TR></TABLE><BR><TABLE border="0" cellpadding="0"
cellspacing="0" width="620"><TR><TD bgcolor="#0086b2"><IMG height="1"
src="images/dot.gif" width="1"></TD></TR><TR><TD align="center"><FONT
color="#0086b2" size="-1"><I>
Copyright © 2001 The Apache Software Foundation.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]