XML::SAX::ExpatXS on Windows. Have mercy on me!

A

Arvin Portlock

I've been trying to find a good XML parsing solution on Windows
for several days and it's driving me crazy! Nothing seems to work.
I started with XML::parser but with the latest version of Active
State perl, latest ppm installs, perl crashes with the infamous
"Perl.exe has generated errors" on some XML documents. I then
tried Twig but its lack of support for namespaces didn't work
for me, plus its model wasn't a very convenient one for what I'm
doing. LibXML doesn't seem efficient enough for the really huge
XML documents I'm processing.

Finally I'm trying ExpatXS. The ppm didn't install libexpat.dll,
but I managed to find it, and install it. I got an error about
strict "refs" in Base.pm, fixed that by putting in a no strict "refs"
at the appropriate point. Now I'm getting the error:

No _parse_* routine defined on this driver (if it a filter,
remember to set the Parent property) [XML::SAX::ExpatXS=HASH(0x1ab2764)]
at D:/apps/perl/site/lib/XML/SAX/Base.pm line 2308.

I tried the code from the few measily examples I could find
(Here's the latest iteration)

use XML::SAX::ExpatXS;
use strict 'vars';

my $xmlfile = 'test.xml';

my $handler = new MyHandler;
my $parser = new XML::SAX::ExpatXS ( Handler => $handler );
$parser->parse($xmlfile);

package MyHandler;

sub new {
my $type = shift;
return bless {}, $type;
}

__END__

Someone please have mercy on me! I thought parsing XML was
supposed to be easy with perl. I've been using perl to parse
SGML on Windows for years and years. But trying to modernize
to XML is a nightmare on Windows. Perl crashes, ppms don't
work, nobody's supposed to use XML::parser anymore but trying
to pick a better event-based parser is confusing to say the
least. What am I doing wrong? What is the best event-based XML
parsing method that's the fastest and works with huge XML
documents and supports namespaces and entity management?

Help via private email is more than welcome please:

rodent at gmail.com

(replace 'at' with '@'))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top