Hello!
I've got XML::Xerces 2.3.0-2 from the ppm available at xml.apache.org and I'm using to
validate documents against an external schema.
This simple code seems to work fine:
#!/usr/bin/perl -w
use strict;
use XML::Xerces;
die "Usage: $0 <xml document name> <schema name>\n" unless
defined $ARGV[0] && -f $ARGV[0] && defined $ARGV[1] && -f $ARGV[1];
my $parser = XML::Xerces::XercesDOMParser->new;
$parser->setValidationScheme($XML::Xerces::AbstractDOMParser::Val_Always);
$parser->setDoNamespaces(1);
$parser->setCreateEntityReferenceNodes(1);
$parser->setDoSchema(1);
$parser->setExternalNoNamespaceSchemaLocation($ARGV[1]);
$parser->setExitOnFirstFatalError(0);
$parser->setValidationConstraintFatal(0);
my $error_handler = XML::Xerces::PerlErrorHandler->new();
$parser->setErrorHandler($error_handler);
eval {
$parser->parse($ARGV[0]);
};
XML::Xerces::error($@) if ($@);
__END__
This program exits at the first schema error, though, and I want to get a report of
all the errors. I found a post to the xerces-c list which suggests that reporting all
the errors is the default
(http://nagoya.apache.org/eyebrowse/ReadMsg?listId=81&msgNo=5366) so it seems like
there's at least hope I could get this behavior.
I would be very happy if anyone could offer advice on how I might get this to work.
Forrest Cahoon
not speaking for merrill corporation