Matt, be proud of me

jdavidb on 2002-08-30T12:11:21

I'm reading XML::SAX::Intro this morning. Something in me told me it's finally time.


I'm doing something all wrong...

jdavidb on 2002-08-30T12:51:24

XML::SAX::Intro contains the following example:

use XML::SAX;
use MySAXHandler;

my $parser = XML::SAX::ParserFactory->new(
    Handler => MySAXHandler->new
);

$parser->parse_uri("foo.xml");

I've got almost exactly that, with MySAXHandler defined as a subclass of XML::SAX::Base with no overridden methods, and I get:

Can't locate object method "parse_uri" via package "XML::SAX::ParserFactory"

I'm sure I'll figure this out somehow...

Re:I'm doing something all wrong...

jdavidb on 2002-08-30T12:54:31

And here it is! Typo in the docs; instead of calling the new method of the XML::SAX::ParserFactory class, you're supposed to call the parser method, according to the XML::SAX::ParserFactory POD.

Re:I'm doing something all wrong...

darobin on 2002-08-31T16:51:12

Glad to see you found the answer to your problem :) Please also note that you don't need to (and in fact probably shouldn't) inherit from XSB for Handlers. It's only for Drivers and Filters. What happened is that we optimised for the most common case, which is the Handler. So all you need there is the methods that you wish to use, *nothing* else.