Howdy.
I am having trouble with Xerces.pm, while trying to do a "Progressive Parse"
with the SAX2 parser. The following error keeps cropping up:
"Could not determine base pathname of the file
at sax2fun.pl line 126."
The weird thing about the error is that it doesn't occur if I do a regular
(non-progressive) parse (this simply entails replacing the parseFirst() call
with a plain parse() call), or if I do the progressive parse with the SAX 1
parser.
Furthermore, the error even crops up when I use a memBuffer
inputsource, hence skipping the local file stuff altogther.
What's happening here? I've digged through the C++ source trying to find
answers but none have come.
Why should the "Progressive Parse" behave differently from a regular parse
with regard to finding/not finding the input source? Me thinks something
bigger
is afoot. Perhaps someone out there could grant me some enlightenment.
I am using xerces-c-src1_7_0 with Xerces Perl XML-Xerces-1.7.0_0.
I built the sources on a Redhat linux 7.0 platform. The Xerces C++ dist
was built with the following autoconf parameters:
runConfigure -plinux -cgcc -xg++ -minmem -nsocket -tnative -rpthread
Thanks for ANY and ALL help with this.
My perl code is below.
-DJ Special Ed
[EMAIL PROTECTED]
-----------------------------
#!/usr/bin/perl -w
use strict;
use XML::Xerces;
@ARGV or die "please provide the name of an XML file\n";
my $file = shift(@ARGV);
-e $file or die "Couldn't find `$file'\n";
# ------------------------
package MyContentHandler;
use vars qw(@ISA);
@ISA = qw(XML::Xerces::PerlContentHandler);
# Just include some empty handlers for now:
sub start_element
{
my ($self,$uri,$localname,$qname,$attrs) = @_;
}
sub end_element
{
my ($self,$name) = @_;
}
sub characters
{
my ($self,$str,$len) = @_;
}
sub ignorable_whitespace
{
my ($self,$str,$len) = @_;
}
# -------------
package main;
my $parser = XML::Xerces::XMLReaderFactory::createXMLReader();
$@ and ( ref($@) ? die($@->getMessage) : die($@) );
my $error_handler = XML::Xerces::PerlErrorHandler->new();
$parser->setErrorHandler($error_handler);
my $CONTENT_HANDLER = MyContentHandler->new();
$parser->setContentHandler($CONTENT_HANDLER);
my $scantoken = XML::Xerces::XMLPScanToken->new();
eval { $parser->parseFirst(
XML::Xerces::LocalFileInputSource->new($file),
XML::Xerces::XMLPScanToken->new());
};
$@ and ( ref($@) ? die($@->getMessage) : die($@) );
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Here's line 126 where we die.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]