zip:update-entries - unexpected results

Monday, 16 November 2015 · 4 messages · last reply 18 Nov 2015
HE
Hondros, Constantine (ELS-AMS)16 Nov 2015 17:06 #
Hi all, I'm attempting to create a modified copy a zipfile using zip:update-entries, but my output is a zip structure with zero-byte files. Am I missing a step? I've followed the example in: http://docs.basex.org/wiki/ZIP_Module#zip:update-entries Code snippet as follows:
declare function util:clean-zip($zip as xs:string, $out as xs:string) {
  copy $doc := zip:entries($zip)
  modify delete node $doc//zip:entry[ends-with(lower-case(@name), '.pdf')]
  return zip:update-entries($doc, $out)
};
Thanks for any pointers ;-) C. ________________________________ Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The Netherlands, Registration No. 33156677, Registered in The Netherlands.
CG
Christian Grün17 Nov 2015 19:31 #
We didn’t spend energy in the ZIP Module for a long time. Did you try to use the Archive Module?
Quoted text · Constantine (ELS-AMS) · 40 lines
On Mon, Nov 16, 2015 at 5:06 PM, Hondros, Constantine (ELS-AMS) <C.Hondros at elsevier.com> wrote: > Hi all, > > > > I’m attempting to create a modified copy a zipfile using zip:update-entries, > but my output is a zip structure with zero-byte files. Am I missing a step? > I’ve followed the example in: > http://docs.basex.org/wiki/ZIP_Module#zip:update-entries > > > > Code snippet as follows: > > > > declare function util:clean-zip($zip as xs:string, $out as xs:string) { > > copy $doc := zip:entries($zip) > > modify delete node $doc//zip:entry[ends-with(lower-case(@name), '.pdf')] > > return zip:update-entries($doc, $out) > > }; > > > > Thanks for any pointers ;-) > > > > C. > > > ________________________________ > > Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The > Netherlands, Registration No. 33156677, Registered in The Netherlands.
HE
Hondros, Constantine (ELS-AMS)18 Nov 2015 10:09 #
Hi Christian, Thanks - I rewrote to use the archive module and it works beautifully. Please note: the Wiki entry for the Zip module still reads: "It may soon be replaced by the Archive Module. " I'll happily update the Wiki entry for you if you like. Kind regards, C.
Quoted text · Christian Grün · 49 lines
-----Original Message----- From: Christian Grün [mailto:christian.gruen at gmail.com] Sent: 17 November 2015 19:31 To: Hondros, Constantine (ELS-AMS) Cc: basex-talk at mailman.uni-konstanz.de Subject: Re: [basex-talk] zip:update-entries - unexpected results We didn’t spend energy in the ZIP Module for a long time. Did you try to use the Archive Module? On Mon, Nov 16, 2015 at 5:06 PM, Hondros, Constantine (ELS-AMS) <C.Hondros at elsevier.com> wrote: > Hi all, > > > > I’m attempting to create a modified copy a zipfile using > zip:update-entries, but my output is a zip structure with zero-byte files. Am I missing a step? > I’ve followed the example in: > http://docs.basex.org/wiki/ZIP_Module#zip:update-entries > > > > Code snippet as follows: > > > > declare function util:clean-zip($zip as xs:string, $out as xs:string) > { > > copy $doc := zip:entries($zip) > > modify delete node $doc//zip:entry[ends-with(lower-case(@name), > '.pdf')] > > return zip:update-entries($doc, $out) > > }; > > > > Thanks for any pointers ;-) > > > > C. > > > ________________________________ > > Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The > Netherlands, Registration No. 33156677, Registered in The Netherlands. Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The Netherlands, Registration No. 33156677, Registered in The Netherlands.
CG
Christian Grün18 Nov 2015 10:12 #
Quoted text · Hondros, Constantine (ELS-AMS) · 1 line
> Please note: the Wiki entry for the Zip module still reads: "It may soon be replaced by the Archive Module. "
I agree, the wording is a bit fuzzy. Indeed we wanted to remove the ZIP Module, but as it’s still used in some applications, it’s still available. What better wording do you have in mind? Maybe something like "We recommend you to use the newer Archive Module."?
Quoted text · Hondros, Constantine (ELS-AMS) · 59 lines
> > Kind regards, > C. > > -----Original Message----- > From: Christian Grün [mailto:christian.gruen at gmail.com] > Sent: 17 November 2015 19:31 > To: Hondros, Constantine (ELS-AMS) > Cc: basex-talk at mailman.uni-konstanz.de > Subject: Re: [basex-talk] zip:update-entries - unexpected results > > We didn’t spend energy in the ZIP Module for a long time. Did you try to use the Archive Module? > > > On Mon, Nov 16, 2015 at 5:06 PM, Hondros, Constantine (ELS-AMS) <C.Hondros at elsevier.com> wrote: >> Hi all, >> >> >> >> I’m attempting to create a modified copy a zipfile using >> zip:update-entries, but my output is a zip structure with zero-byte files. Am I missing a step? >> I’ve followed the example in: >> http://docs.basex.org/wiki/ZIP_Module#zip:update-entries >> >> >> >> Code snippet as follows: >> >> >> >> declare function util:clean-zip($zip as xs:string, $out as xs:string) >> { >> >> copy $doc := zip:entries($zip) >> >> modify delete node $doc//zip:entry[ends-with(lower-case(@name), >> '.pdf')] >> >> return zip:update-entries($doc, $out) >> >> }; >> >> >> >> Thanks for any pointers ;-) >> >> >> >> C. >> >> >> ________________________________ >> >> Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The >> Netherlands, Registration No. 33156677, Registered in The Netherlands. > > ________________________________ > > Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The Netherlands, Registration No. 33156677, Registered in The Netherlands.

⚡Generated with XQuery