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 ;) > 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-for-upstream > 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-devel mailing list Koha-devel@lists.koha.org http://lists.koha.org/mailman/listinfo/koha-devel