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