From c520ca3b8d20b2e62b6975f49bd0449c8871595a Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 9 Feb 2018 12:02:54 -0300 Subject: [PATCH] Bug 17704: Adapt Koha::OAI::* to the new HTTP::OAI api This is my attempt to adapt the existing implementation to the new version of the HTTP::OAI lib. Currently 4.06 is released, but 4.07 should be used once released, as it contains the fix for the ->xslt method missing. Signed-off-by: David Cook --- Koha/OAI/Server/Repository.pm | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Koha/OAI/Server/Repository.pm b/Koha/OAI/Server/Repository.pm index 558606d57d..f84035087b 100644 --- a/Koha/OAI/Server/Repository.pm +++ b/Koha/OAI/Server/Repository.pm @@ -96,7 +96,6 @@ Note the 'include_items' parameter which is the only mean to return item-level i =cut - sub new { my ($class, %args) = @_; my $self = $class->SUPER::new(%args); @@ -147,9 +146,24 @@ sub new { $response = $class->new($self, %attr); } - $response->set_handler( XML::SAX::Writer->new( Output => *STDOUT ) ); - $response->xslt( "/opac-tmpl/xslt/OAI.xslt" ); - $response->generate; + my $w = XML::SAX::Writer->new( Output => *STDOUT ); + + my $driver = HTTP::OAI::SAX::Driver->new( + Handler => my $builder = XML::LibXML::SAX::Builder->new() + ); + + $self->{ driver } = $driver; + $self->{ builder } = $builder; + + $driver->start_oai_pmh(); + + $response->set_handler($w); + #$response->xslt( "/opac-tmpl/xslt/OAI.xslt" ); + $response->generate($driver); + + $driver->end_oai_pmh(); + + print $builder->result; bless $self, $class; return $self; -- 2.11.0