Hello all, 

I'm Xan Charbonnet with Biblionix.  We run a web-based library automation 
system called Apollo.

We're trying to garner support for an XML-based standard for library 
automation, specifically in order to make migration easier from one ILS to 
another.  See http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6891 if 
you're interested in more details.  That standard might be of general interest 
to this list, in which case let's by all means work together on it.

But the specific reason that I'm writing today actually has to do with a 
proposed improvement to MARC::File::XML.  I wrote to Ed Summers just now, and 
he pointed me to this list.

When we import data from this XML format (we tentatively call it "LDIF") via 
MARC::File::XML's new_from_xml, I've noticed that if something goes wrong (a 
bad character, for example), then I can never use new_from_xml again in that 
run of my script.  Instead I get a "parser is already parsing" error.

I've made a small change to MARC::File::XML to work around this.  In the 
"decode" function, instead of:
$parser->parse_string( $text );

I now re-create the parser if something goes wrong:
eval { $parser->parse_string( $text ); };
if($@) {
        $factory = XML::SAX::ParserFactory->new();
        $factory->require_feature(Namespaces);
        $parser = $factory->parser( Handler => $handler, ProtocolEncoding => 
'UTF-8' );
        $parser->parse_string( $text );
    }

There is probably a much more elegant way to go about this, but I thought I 
would put this out there, in case it (or something similar) could be included 
in the mainline code, and help others.  Okay, and selfishly it would be easier 
for us not to have to maintain a forked version!

Thanks,
Xan

Reply via email to