How do I use "archive:update" to add a new binary file to an existing archive?

Tuesday, 6 August 2013 · 5 messages · last reply 7 Aug 2013
JB
Jörg Beisiegel6 Aug 2013 14:08 #
Hello, unfortunately I do not get the archive:update function to work... I am using BaseX 7.6. Your sample to update text in a Word 2010 document works fine. Creating a new archive and extracting from an archive works fine too. When I try to update an existing archive with a new image file I get the error "element(archive:entry) or string expected, element() found. I have modified your Word sample query as follows:
declare variable $input  := "input.zip";
declare variable $output := "output.zip";
declare variable $doc    := "Image.png";
declare variable $img    := "new_image_in_file_system.png";

let $archive := file:read-binary($input)
let $entry   :=  file:read-binary($img)
let $updated := archive:update($archive, <entry>{$doc}</entry>, $entry)
return file:write-binary($output, $updated)
Thank you very much for your help. Regards, Jörg
CG
Christian Grün6 Aug 2013 14:47 #
Dear Jörg, have you tried BaseX 7.7 Beta [1]? The official release will be available in a few days. Best, Christian [1] http://files.basex.org/releases/latest/ ___________________________ 2013/8/6 Jörg Beisiegel <Joerg.Beisiegel at translatissimo.de>:
Quoted text · Jörg Beisiegel · 58 lines
> Hello, > > unfortunately I do not get the archive:update function to work… I am using > BaseX 7.6. > > Your sample to update text in a Word 2010 document works fine. > > Creating a new archive and extracting from an archive works fine too. > > > > When I try to update an existing archive with a new image file I get the > error “element(archive:entry) or string expected, element() found. > > > > I have modified your Word sample query as follows: > > declare variable $input := "input.zip"; > > declare variable $output := "output.zip"; > > declare variable $doc := "Image.png"; > > declare variable $img := "new_image_in_file_system.png"; > > > > let $archive := file:read-binary($input) > > let $entry := file:read-binary($img) > > let $updated := archive:update($archive, <entry>{$doc}</entry>, $entry) > > return file:write-binary($output, $updated) > > > > > > Thank you very much for your help. > > > > Regards, > > Jörg > > > > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
JB
Jörg Beisiegel6 Aug 2013 15:37 #
Dear Christian, yes, I have downloaded it about 2 hours ago, but I got the same error message. Best, Jörg Jörg Beisiegel Geschäftsführer / Managing Director Localization Consulting Desk phone: +49 7275 98933-22 mailto:joerg.beisiegel at translatissimo.de translatissimo Übersetzung und Lokalisierung GbR Bismarckstr. 19 * D-76870 Kandel * Germany http://www.translatissimo.de *** HINWEIS *** NOTE *** Falls die Mail Anhänge enthält, bitte Empfang bestätigen. If this mail contains attachments please confirm receipt.
Quoted text · Christian Grün · 71 lines
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen at gmail.com] Gesendet: Dienstag, 6. August 2013 14:48 An: Jörg Beisiegel Cc: basex-talk at mailman.uni-konstanz.de Betreff: Re: [basex-talk] How do I use "archive:update" to add a new binary file to an existing archive? Dear Jörg, have you tried BaseX 7.7 Beta [1]? The official release will be available in a few days. Best, Christian [1] http://files.basex.org/releases/latest/ 2013/8/6 Jörg Beisiegel <Joerg.Beisiegel at translatissimo.de>: > Hello, > > unfortunately I do not get the archive:update function to work. I am > using BaseX 7.6. > > Your sample to update text in a Word 2010 document works fine. > > Creating a new archive and extracting from an archive works fine too. > > > > When I try to update an existing archive with a new image file I get > the error "element(archive:entry) or string expected, element() found. > > > > I have modified your Word sample query as follows: > > declare variable $input := "input.zip"; > > declare variable $output := "output.zip"; > > declare variable $doc := "Image.png"; > > declare variable $img := "new_image_in_file_system.png"; > > > > let $archive := file:read-binary($input) > > let $entry := file:read-binary($img) > > let $updated := archive:update($archive, <entry>{$doc}</entry>, > $entry) > > return file:write-binary($output, $updated) > > > > > > Thank you very much for your help. > > > > Regards, > > Jörg > > > > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
CG
Christian Grünin reply to Jörg Beisiegel, 6 Aug 2013, 14:087 Aug 2013 09:34 #
Hi Jörg, your query should work if you use the "archive:" prefix for your entry element:
 let $updated := archive:update($archive,
<archive:entry>{$doc}</archive:entry>, $entry)
If you don’t specify on any options, you can also omit the element:
 let $updated := archive:update($archive, $doc, $entry)
Hope this helps, Christian ___________________________ 2013/8/6 Jörg Beisiegel <Joerg.Beisiegel at translatissimo.de>:
Quoted text · Jörg Beisiegel · 58 lines
> Hello, > > unfortunately I do not get the archive:update function to work… I am using > BaseX 7.6. > > Your sample to update text in a Word 2010 document works fine. > > Creating a new archive and extracting from an archive works fine too. > > > > When I try to update an existing archive with a new image file I get the > error “element(archive:entry) or string expected, element() found. > > > > I have modified your Word sample query as follows: > > declare variable $input := "input.zip"; > > declare variable $output := "output.zip"; > > declare variable $doc := "Image.png"; > > declare variable $img := "new_image_in_file_system.png"; > > > > let $archive := file:read-binary($input) > > let $entry := file:read-binary($img) > > let $updated := archive:update($archive, <entry>{$doc}</entry>, $entry) > > return file:write-binary($output, $updated) > > > > > > Thank you very much for your help. > > > > Regards, > > Jörg > > > > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
JB
Jörg Beisiegel7 Aug 2013 11:18 #
Hi Christian, thank you very much! With the "archive:" prefix it works. Thank you for all the great work you guys are doing within this project. Best, Jörg
Quoted text · Christian Grün · 73 lines
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen at gmail.com] Gesendet: Mittwoch, 7. August 2013 09:34 An: Jörg Beisiegel Cc: basex-talk at mailman.uni-konstanz.de Betreff: Re: [basex-talk] How do I use "archive:update" to add a new binary file to an existing archive? Hi Jörg, your query should work if you use the "archive:" prefix for your entry element: let $updated := archive:update($archive, <archive:entry>{$doc}</archive:entry>, $entry) If you don't specify on any options, you can also omit the element: let $updated := archive:update($archive, $doc, $entry) Hope this helps, Christian 2013/8/6 Jörg Beisiegel <Joerg.Beisiegel at translatissimo.de>: > Hello, > > unfortunately I do not get the archive:update function to work. I am > using BaseX 7.6. > > Your sample to update text in a Word 2010 document works fine. > > Creating a new archive and extracting from an archive works fine too. > > > > When I try to update an existing archive with a new image file I get > the error "element(archive:entry) or string expected, element() found. > > > > I have modified your Word sample query as follows: > > declare variable $input := "input.zip"; > > declare variable $output := "output.zip"; > > declare variable $doc := "Image.png"; > > declare variable $img := "new_image_in_file_system.png"; > > > > let $archive := file:read-binary($input) > > let $entry := file:read-binary($img) > > let $updated := archive:update($archive, <entry>{$doc}</entry>, > $entry) > > return file:write-binary($output, $updated) > > > > > > Thank you very much for your help. > > > > Regards, > > Jörg > > > > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >

⚡Generated with XQuery