Difference between revisions of "Archive Module"
(Created page with "This XQuery Module contains functions to handle ZIP archives. New ZIP archives can be created, existing archives can be updated, and the archive entries can be...") |
|||
Line 20: | Line 20: | ||
|- | |- | ||
| '''Errors''' | | '''Errors''' | ||
− | |{{Error|FOZ20001|#Errors}} the number of entries and contents differs.<br />{{Error|FOZ20002|#Errors}} (some of) the contents are not strings or binaries.<br />{{Error|FOZ20003|#Errors}} (some of) the entries elements contain invalid data.{{Error|FOZ20004|#Errors}} the specified encoding is invalid or not supported.<br/>{{Error| | + | |{{Error|FOZ20001|#Errors}} the number of entries and contents differs.<br />{{Error|FOZ20002|#Errors}} (some of) the contents are not strings or binaries.<br />{{Error|FOZ20003|#Errors}} (some of) the entries elements contain invalid data.<br/>{{Error|FOZ20004|#Errors}} the specified encoding is invalid or not supported.<br/>{{Error|FOZ29999|#Errors}} archive processing failed for some other reason. |
|- | |- | ||
| '''Examples''' | | '''Examples''' |
Revision as of 20:58, 28 May 2012
This XQuery Module contains functions to handle ZIP archives. New ZIP archives can be created, existing archives can be updated, and the archive entries can be listed and extracted. This module may eventually replace the existing ZIP Module as soon as it is finalized and adopted by other XQuery implementations.
Conventions
All functions in this module are assigned to the http://basex.org/modules/zip2
namespace, which is statically bound to the zip2
prefix.
All errors are assigned to the http://basex.org/errors
namespace, which is statically bound to the bxerr
prefix.
Functions
zip:create
Signatures | zip:create($entries as element(entry)*, $contents as item()*) as xs:base64Binary |
Summary | Creates a new ZIP archive from the specified entries and contents.
The |
Errors | FOZ20001 : the number of entries and contents differs.FOZ20002 : (some of) the contents are not strings or binaries.FOZ20003 : (some of) the entries elements contain invalid data.FOZ20004 : the specified encoding is invalid or not supported.FOZ29999 : archive processing failed for some other reason.
|
Examples | The following function creates a file archive.zip with the file file.txt inside:
zip:create( <file xmlns="http://expath.org/ns/zip" href="archive.zip"> <entry src="file.txt"/> </file>) The following function creates a file zip:zip-file( <file xmlns="http://expath.org/ns/zip" href="archive.zip"> <entry name="readme">thanks</entry> </file>) |