XQuery Function Documentation

Search and Browse

http://exist-db.org/xquery/compression

java:org.exist.xquery.modules.compression.CompressionModule

A module for compression and decompression functions

compression:db-store-entry3

compression:db-store-entry3($destination as xs:string?) as function(*)

Stores an entry to the database. Attempts to guard against exit attacks; If an exit attack is detected then the error `compression:archive-exit-attack is raised`.

Parameters:
$destination? A path to a Collection in the database where the entry should be extracted. If the Collection does not exist it will be created.
Returns:
function(*) : A function suitable for passing as the $entry-data#3

compression:db-store-entry4

compression:db-store-entry4($destination as xs:string?) as function(*)

Stores an entry to the database. Attempts to guard against exit attacks; If an exit attack is detected then the error `compression:archive-exit-attack is raised`.

Parameters:
$destination? A path to a Collection in the database where the entry should be extracted. If the Collection does not exist it will be created.
Returns:
function(*) : A function suitable for passing as the $entry-data#4

compression:deflate

compression:deflate($data as xs:base64Binary) as xs:base64Binary?

Deflate data (RFC 1950)

Parameters:
$data The data to Deflate
Returns:
xs:base64Binary?

compression:deflate

compression:deflate($data as xs:base64Binary, $raw as xs:boolean) as xs:base64Binary?

Deflate data (RFC 1951)

Parameters:
$data The data to Deflate
$raw If true, create raw deflate data that is not wrapped inside zlib header and checksum.
Returns:
xs:base64Binary?

compression:fs-store-entry3

compression:fs-store-entry3($destination as xs:string?) as function(*)

Stores an entry to the filesystem. This method is only available to the DBA role. Attempts to guard against exit attacks; If an exit attack is detected then the error `compression:archive-exit-attack is raised`.

Parameters:
$destination? A path to a directory on the filesystem where the entry should be extracted. If the path does not exist it will be created.
Returns:
function(*) : A function suitable for passing as the $entry-data#3

compression:fs-store-entry4

compression:fs-store-entry4($destination as xs:string?) as function(*)

Stores an entry to the filesystem. This method is only available to the DBA role. Attempts to guard against exit attacks; If an exit attack is detected then the error `compression:archive-exit-attack is raised`.

Parameters:
$destination? A path to a directory on the filesystem where the entry should be extracted. If the path does not exist it will be created.
Returns:
function(*) : A function suitable for passing as the $entry-data#4

compression:gzip

compression:gzip($data as xs:base64Binary) as xs:base64Binary?

GZip's data

Parameters:
$data The data to GZip
Returns:
xs:base64Binary?

compression:inflate

compression:inflate($inflate-data as xs:base64Binary) as xs:base64Binary?

Inflate data (RFC 1950)

Parameters:
$inflate-data The inflate data to uncompress.
Returns:
xs:base64Binary?

compression:inflate

compression:inflate($inflate-data as xs:base64Binary, $raw as xs:boolean) as xs:base64Binary?

Inflate data (RFC 1951)

Parameters:
$inflate-data The inflate data to uncompress.
$raw If true, expect raw deflate data that is not wrapped inside zlib header and checksum.
Returns:
xs:base64Binary?

compression:no-filter

compression:no-filter($path as xs:string, $data-type as xs:string) as xs:boolean

Does not filter any entries.

Parameters:
$path The path of the entry
$data-type The type of the entry, either 'directory' or 'resource'.
Returns:
xs:boolean : Always true, so that no entries are filtered. Parameters are ignored.

compression:no-filter

compression:no-filter($path as xs:string, $data-type as xs:string, $param as item()*) as xs:boolean

Does not filter any entries.

Parameters:
$path The path of the entry
$data-type The type of the entry, either 'directory' or 'resource'.
$param* One or more parameters.
Returns:
xs:boolean : Always true, so that no entries are filtered. Parameters are ignored.

compression:tar

compression:tar($sources as xs:anyType+, $use-collection-hierarchy as xs:boolean) as xs:base64Binary*

Tars nodes, resources and collections.

Parameters:
$sources+ The sequence of URI's and/or Entrys. If an URI points to a collection then the collection, its resources and sub-collections are zipped recursively. If URI points to file (available only to the DBA role.) then file or directory are zipped. An Entry takes the format <entry name="filename.ext" type="collection|uri|binary|xml|text" method="deflate|store">data</entry>. The method attribute is only effective for the compression:zip function.
$use-collection-hierarchy Indicates whether the Collection hierarchy (if any) should be preserved in the zip file.
Returns:
xs:base64Binary*

compression:tar

compression:tar($sources as xs:anyType+, $use-collection-hierarchy as xs:boolean, $strip-prefix as xs:string) as xs:base64Binary*

Tars nodes, resources and collections.

Parameters:
$sources+ The sequence of URI's and/or Entrys. If an URI points to a collection then the collection, its resources and sub-collections are zipped recursively. If URI points to file (available only to the DBA role.) then file or directory are zipped. An Entry takes the format <entry name="filename.ext" type="collection|uri|binary|xml|text" method="deflate|store">data</entry>. The method attribute is only effective for the compression:zip function.
$use-collection-hierarchy Indicates whether the Collection hierarchy (if any) should be preserved in the zip file.
$strip-prefix This prefix is stripped from the Entrys name
Returns:
xs:base64Binary*

compression:tar

compression:tar($sources as xs:anyType+, $use-collection-hierarchy as xs:boolean, $strip-prefix as xs:string, $encoding as xs:string) as xs:base64Binary*

Tars nodes, resources and collections.

Parameters:
$sources+ The sequence of URI's and/or Entrys. If an URI points to a collection then the collection, its resources and sub-collections are zipped recursively. If URI points to file (available only to the DBA role.) then file or directory are zipped. An Entry takes the format <entry name="filename.ext" type="collection|uri|binary|xml|text" method="deflate|store">data</entry>. The method attribute is only effective for the compression:zip function.
$use-collection-hierarchy Indicates whether the Collection hierarchy (if any) should be preserved in the zip file.
$strip-prefix This prefix is stripped from the Entrys name
$encoding This encoding to be used for filenames inside the compressed file
Returns:
xs:base64Binary*

compression:ungzip

compression:ungzip($gzip-data as xs:base64Binary) as xs:base64Binary?

UnGZip's data

Parameters:
$gzip-data The gzip data to uncompress.
Returns:
xs:base64Binary?

compression:untar

compression:untar($tar-data as xs:base64Binary, $entry-filter as function(*), $entry-data as function(*)) as item()*

UnTar all the resources/folders from the provided data by calling user defined functions to determine what and how to store the resources/folders

Parameters:
$tar-data The tar file data
$entry-filter A user defined function for filtering resources from the tar file. The function takes 2 parameters e.g. user:untar-entry-filter($path as xs:string, $data-type as xs:string) as xs:boolean. $data-type may be 'resource' or 'folder'. If the return type is true() it indicates the entry should be processed and passed to the entry-data function, else the resource is skipped. If you wish to extract all resources you can use the provided compression:no-filter#2 function.
$entry-data A user defined function for storing an extracted resource from the tar file. The function takes 3 parameters e.g. user:untar-entry-data($path as xs:string, $data-type as xs:string, $data as item()?). Or a user defined function which returns a db path for storing an extracted resource from the tar file. The function takes 3 parameters e.g. user:entry-path($path as xs:string, $data-type as xs:string, $param as item()*) as xs:anyURI. $data-type may be 'resource' or 'folder'. Functions for storing the entries to a folder on the filesystem or a collection in the database provided by compression:fs-store-entry3($dest) and compression:db-store-entry3($dest).
Returns:
item()*

compression:untar

compression:untar($tar-data as xs:base64Binary, $entry-filter as function(*), $entry-filter-param as xs:anyType*, $entry-data as function(*), $entry-data-param as xs:anyType*) as item()*

UnTar all the resources/folders from the provided data by calling user defined functions to determine what and how to store the resources/folders

Parameters:
$tar-data The tar file data
$entry-filter A user defined function for filtering resources from the tar file. The function takes 3 parameters e.g. user:untar-entry-filter($path as xs:string, $data-type as xs:string, $param as item()*) as xs:boolean. $data-type may be 'resource' or 'folder'. $param is a sequence with any additional parameters, for example a list of extracted files. If the return type is true() it indicates the entry should be processed and passed to the entry-data function, else the resource is skipped. If you wish to extract all resources you can use the provided compression:no-filter#3 function.
$entry-filter-param* A sequence with an additional parameters for filtering function.
$entry-data A user defined function for storing an extracted resource from the tar file. The function takes 4 parameters e.g. user:untar-entry-data($path as xs:string, $data-type as xs:string, $data as item()?, $param as item()*). Or a user defined function which returns a db path for storing an extracted resource from the tar file. The function takes 3 parameters e.g. user:entry-path($path as xs:string, $data-type as xs:string, $param as item()*) as xs:anyURI. $data-type may be 'resource' or 'folder'. $param is a sequence with any additional parametersFunctions for storing the entries to a folder on the filesystem or a collection in the database provided by compression:fs-store-entry4($dest) and compression:db-store-entry4($dest).
$entry-data-param* A sequence with an additional parameters for storing function.
Returns:
item()*

compression:untar

compression:untar($tar-data as xs:base64Binary, $entry-filter as function(*), $entry-filter-param as xs:anyType*, $entry-data as function(*), $entry-data-param as xs:anyType*, $encoding as xs:string) as item()*

UnTar all the resources/folders from the provided data by calling user defined functions to determine what and how to store the resources/folders

Parameters:
$tar-data The tar file data
$entry-filter A user defined function for filtering resources from the tar file. The function takes 3 parameters e.g. user:untar-entry-filter($path as xs:string, $data-type as xs:string, $param as item()*) as xs:boolean. $data-type may be 'resource' or 'folder'. $param is a sequence with any additional parameters, for example a list of extracted files. If the return type is true() it indicates the entry should be processed and passed to the entry-data function, else the resource is skipped. If you wish to extract all resources you can use the provided compression:no-filter#3 function.
$entry-filter-param* A sequence with an additional parameters for filtering function.
$entry-data A user defined function for storing an extracted resource from the tar file. The function takes 4 parameters e.g. user:untar-entry-data($path as xs:string, $data-type as xs:string, $data as item()?, $param as item()*). Or a user defined function which returns a db path for storing an extracted resource from the tar file. The function takes 3 parameters e.g. user:entry-path($path as xs:string, $data-type as xs:string, $param as item()*) as xs:anyURI. $data-type may be 'resource' or 'folder'. $param is a sequence with any additional parametersFunctions for storing the entries to a folder on the filesystem or a collection in the database provided by compression:fs-store-entry4($dest) and compression:db-store-entry4($dest).
$entry-data-param* A sequence with an additional parameters for storing function.
$encoding The encoding to be used during uncompressing eg: UTF8 or Cp437 from https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html
Returns:
item()*

compression:unzip

compression:unzip($zip-data as xs:base64Binary, $entry-filter as function(*), $entry-data as function(*)) as item()*

UnZip all the resources/folders from the provided data by calling user defined functions to determine what and how to store the resources/folders

Parameters:
$zip-data The zip file data
$entry-filter A user defined function for filtering resources from the zip file. The function takes 2 parameters e.g. user:unzip-entry-filter($path as xs:string, $data-type as xs:string) as xs:boolean. $data-type may be 'resource' or 'folder'. If the return type is true() it indicates the entry should be processed and passed to the $entry-data function, else the resource is skipped. If you wish to extract all resources you can use the provided compression:no-filter#2 function.
$entry-data A user defined function for storing an extracted resource from the zip file. The function takes 3 parameters e.g. user:unzip-entry-data($path as xs:string, $data-type as xs:string, $data as item()?). Or a user defined function which returns a db path for storing an extracted resource from the zip file. The function takes 3 parameters e.g. user:entry-path($path as xs:string, $data-type as xs:string, $param as item()*) as xs:anyURI. $data-type may be 'resource' or 'folder'. Functions for storing the entries to a folder on the filesystem or a collection in the database provided by compression:fs-store-entry3($dest) and compression:db-store-entry3($dest).
Returns:
item()*

compression:unzip

compression:unzip($zip-data as xs:base64Binary, $entry-filter as function(*), $entry-filter-param as xs:anyType*, $entry-data as function(*), $entry-data-param as xs:anyType*) as item()*

UnZip all the resources/folders from the provided data by calling user defined functions to determine what and how to store the resources/folders

Parameters:
$zip-data The zip file data
$entry-filter A user defined function for filtering resources from the zip file. The function takes 3 parameters e.g. user:unzip-entry-filter($path as xs:string, $data-type as xs:string, $param as item()*) as xs:boolean. $data-type may be 'resource' or 'folder'. $param is a sequence with any additional parameters, for example a list of extracted files. If the return type is true() it indicates the entry should be processed and passed to the $entry-data function, else the resource is skipped. If you wish to extract all resources you can use the provided compression:no-filter#3 function.
$entry-filter-param* A sequence with an additional parameters for filtering function.
$entry-data A user defined function for storing an extracted resource from the zip file. The function takes 4 parameters e.g. user:unzip-entry-data($path as xs:string, $data-type as xs:string, $data as item()?, $param as item()*). Or a user defined function which returns a db path for storing an extracted resource from the zip file. The function takes 3 parameters e.g. user:entry-path($path as xs:string, $data-type as xs:string, $param as item()*) as xs:anyURI. $data-type may be 'resource' or 'folder'. $param is a sequence with any additional parameters. Functions for storing the entries to a folder on the filesystem or a collection in the database provided by compression:fs-store-entry4($dest) and compression:db-store-entry4($dest).
$entry-data-param* A sequence with an additional parameters for storing function.
Returns:
item()*

compression:unzip

compression:unzip($zip-data as xs:base64Binary, $entry-filter as function(*), $entry-filter-param as xs:anyType*, $entry-data as function(*), $entry-data-param as xs:anyType*, $encoding as xs:string) as item()*

UnZip all the resources/folders from the provided data by calling user defined functions to determine what and how to store the resources/folders

Parameters:
$zip-data The zip file data
$entry-filter A user defined function for filtering resources from the zip file. The function takes 3 parameters e.g. user:unzip-entry-filter($path as xs:string, $data-type as xs:string, $param as item()*) as xs:boolean. $data-type may be 'resource' or 'folder'. $param is a sequence with any additional parameters, for example a list of extracted files. If the return type is true() it indicates the entry should be processed and passed to the $entry-data function, else the resource is skipped. If you wish to extract all resources you can use the provided compression:no-filter#3 function.
$entry-filter-param* A sequence with an additional parameters for filtering function.
$entry-data A user defined function for storing an extracted resource from the zip file. The function takes 4 parameters e.g. user:unzip-entry-data($path as xs:string, $data-type as xs:string, $data as item()?, $param as item()*). Or a user defined function which returns a db path for storing an extracted resource from the zip file. The function takes 3 parameters e.g. user:entry-path($path as xs:string, $data-type as xs:string, $param as item()*) as xs:anyURI. $data-type may be 'resource' or 'folder'. $param is a sequence with any additional parameters. Functions for storing the entries to a folder on the filesystem or a collection in the database provided by compression:fs-store-entry4($dest) and compression:db-store-entry4($dest).
$entry-data-param* A sequence with an additional parameters for storing function.
$encoding The encoding to be used during uncompressing eg: UTF8 or Cp437 from https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html
Returns:
item()*

compression:zip

compression:zip($sources as xs:anyType+, $use-collection-hierarchy as xs:boolean) as xs:base64Binary*

Zips nodes, resources and collections.

Parameters:
$sources+ The sequence of URI's and/or Entrys. If an URI points to a collection then the collection, its resources and sub-collections are zipped recursively. If URI points to file (available only to the DBA role.) then file or directory are zipped. An Entry takes the format <entry name="filename.ext" type="collection|uri|binary|xml|text" method="deflate|store">data</entry>. The method attribute is only effective for the compression:zip function.
$use-collection-hierarchy Indicates whether the Collection hierarchy (if any) should be preserved in the zip file.
Returns:
xs:base64Binary*

compression:zip

compression:zip($sources as xs:anyType+, $use-collection-hierarchy as xs:boolean, $strip-prefix as xs:string) as xs:base64Binary*

Zips nodes, resources and collections.

Parameters:
$sources+ The sequence of URI's and/or Entrys. If an URI points to a collection then the collection, its resources and sub-collections are zipped recursively. If URI points to file (available only to the DBA role.) then file or directory are zipped. An Entry takes the format <entry name="filename.ext" type="collection|uri|binary|xml|text" method="deflate|store">data</entry>. The method attribute is only effective for the compression:zip function.
$use-collection-hierarchy Indicates whether the Collection hierarchy (if any) should be preserved in the zip file.
$strip-prefix This prefix is stripped from the Entrys name
Returns:
xs:base64Binary*

compression:zip

compression:zip($sources as xs:anyType+, $use-collection-hierarchy as xs:boolean, $strip-prefix as xs:string, $encoding as xs:string) as xs:base64Binary*

Zips nodes, resources and collections.

Parameters:
$sources+ The sequence of URI's and/or Entrys. If an URI points to a collection then the collection, its resources and sub-collections are zipped recursively. If URI points to file (available only to the DBA role.) then file or directory are zipped. An Entry takes the format <entry name="filename.ext" type="collection|uri|binary|xml|text" method="deflate|store">data</entry>. The method attribute is only effective for the compression:zip function.
$use-collection-hierarchy Indicates whether the Collection hierarchy (if any) should be preserved in the zip file.
$strip-prefix This prefix is stripped from the Entrys name
$encoding This encoding to be used for filenames inside the compressed file
Returns:
xs:base64Binary*