Vincent Danjean a écrit :
Frederic Demians wrote:
And if we know where the XML parser is called (directly or indirectly), we can set in the koha file(s) the global variable
> $XML::SAX::ParserPackage = "XML::LibXML::SAX"; > in order to force the good XML parser without requiring to modify a global configuration file
Primarily, Koha uses a SAX parser in MARC::File::XML, but also XML::Simple.
XML::LibXML::SAX is specifically required by MARC::File::XML. With another SAX parser, XML MARC records are not correctly decoded-encoded and accented characters, for example, are mixed.
In this file:
MARC/File/XML.pm
line 21:
my $factory = XML::SAX::ParserFactory->new();
a SAX parser is instantiated.
So since MARC::File::XML need XML::LibXML::SAX, it should ask explicitly this parser and insert before line 21, as said by Vincent:
$XML::SAX::ParserPackage = "XML::LibXML::SAX";
Can't someone contact MARC::File:XML package maintainer and ask him to update his code?
Someone can ask but I'm not sure that the MARC::File:XML package maintainer will agree with this modification. Josh is the package maintainer, he may agree with that modification ;) Actually, I'm just the CPAN Package maintainer, I haven't worked on M::F::X much in a while. I believe it's now Mike Rylander now. This code's version control lives at SourceForge the MARCPM project, and
On Sun, Dec 7, 2008 at 6:04 PM, Henri-Damien LAURENT <laurenthdl@alinto.com> wrote: the best forum for discussing this type of issue is probably the Perl4Lib listserv. Cheers, Josh
Perhaps, he will add the line. But he can also answer: - MARC::File::XML can work with other XML parser if there is no accentuated letter (no non-ASCII letter) so I do not want to force a specific dependency or - MARC::File::XML requires a correct XML parser. If one XML parser is buggy then bug must be filled against this XML parser and not against packages that use XML parser. or - MARC::File::XML will implement in a future release a mechanism to be able to choose the XML parser (such as XML::Simple) or - ...
So, asking him is a good thing (perhaps he does not know the issue). But koha can also force the use of the parser it needs (ie add $XML::SAX::ParserPackage = "XML::LibXML::SAX"; when it uses MARC::File::XML)
It would be good also that misc/sax_parser_test.pl really tests the parser (I get the same binary output with XML::LibXML::SAX or with the Expat XML parser)
Note that, according to the XML::Simple documentation, XML::Simple can also force the XML parser it will use by setting: $XML::Simple::PREFERRED_PARSER="XML::LibXML::SAX";
I prepared two commits for koha to force the use of the LibXML parser. Can you test them and apply them if they are ok ? (I only greped for any occurrences of XML::Simple and MARC::File::XML and add the correct line). Both commits are available at the top of my wip-for-upstream branch: http://git.debian.org/?p=collab-maint/koha.git;a=shortlog;h=refs/heads/wip-f... They are: - "Force MARC::File::XML to use the XML::LibXML::SAX parser" and - "Force XML::Simple to use to XML::LibXML::SAX parser"
I'll try your patches.
_______________________________________________ Koha-patches mailing list Koha-patches@lists.koha.org http://lists.koha.org/mailman/listinfo/koha-patches
-- Joshua Ferraro SUPPORT FOR OPEN-SOURCE SOFTWARE CEO migration, training, maintenance, support LibLime Featuring Koha Open-Source ILS jmf@liblime.com |Full Demos at http://liblime.com/koha |1(888)KohaILS