Hi Matt, >> I'm trying to work my way through the new AxKit2 code - but before I >> figure it out myself, maybe someone would be kind enough to help me: >> Where's the equivalent of an AxKit1 Provider?
> We were thinking of whether we should do a hook for this, but instead we > made is so crazy simple we felt a new hook wasn't required. Here's the > equivalent of a provider: > > sub hook_xmlresponse { > my ($self, $processor) = @_; > > # generate xml - either an XML::LibXML DOM, or a string > my $xml = generate_xml(); > $processor->input($xml); > return DECLINED; > } > > I feel that's MUCH better than the AxKit1 model, don't you Oh, yes, if we can make it work that simple, it surely is; but unfortunately, I cannot make it work :-( Here's my code: sub hook_xmlresponse { my ($self, $processor, $hd) = @_; my $filename = $hd->filename; $self->log(LOGDEBUG, "Requested file: $filename"); if ($filename =~ /\.odt$/) { my $zip = Archive::Zip->new(); if ($zip->read($filename) != AZ_OK) { $self->log(LOGDEBUG, 'Corrupted .odt file'); return BAD_REQUEST; } my $fh; my $member; my $path_info = $hd->path_info; $path_info =~ s|^/||; if ($path_info) { $self->log(LOGDEBUG, "Handling path: $path_info"); $member = $zip->memberNamed($path_info); # TODO: This is yet unhandled } else { $member = $zip->memberNamed('content.xml') || $zip->memberNamed('Content.xml'); } $fh = IO::File->new_tmpfile; $member->extractToFileHandle($fh); seek($fh, 0, 0); my $document; while (<$fh>) { $document .= $_; } undef $fh; $processor->input($document); # my $stylesheet = '/mnt/hgfs/VDMS/opendoc.xsl'; # my $out = $processor->transform(XSLT($stylesheet)); # return OK, $out; return DECLINED; } else { return DECLINED; } } As you can see, I've tried to handle it directly in my routine, but I've also tried to do it the way you recommended (with a proper change of axkit.conf, of course). No matter what, I get the same error: 10.0.16.50:3220 L3 FATAL PLUGIN ERROR: Entity: line 1: parser error : Document is empty PK ^ 10.0.16.50:3220 L7 error_xml error Turning error into XML 10.0.16.50:3220 L3 FATAL PLUGIN ERROR: :4: parser error : internal error PK ^ :4: parser error : Extra content at the end of the document PK ^ That PK looks a lot like the beginning of the zipped .odt file (Phil Katz and PKZip still isn't forgotten...), not the unzipped XML file I retrieved above; my $document variable does hold the entire document (I've dumped it to the debug screen), but for some reason the XSLT processor still seems to read the zipped file, not the document I try to pass on? Regards, Lars -- Lars Skjærlund Consultant Ubiquitech A/S Lyngby Hovedgade 4,3 2800 Kgs. Lyngby Denmark Tel: +4570200084 Mobile: +4523457157 http://www.ubiquitech.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]