Zip processorThe Zip processor compresses a set of files you specify by URI. Typically you will use the Zip processor to compress a number of temporary files that you have previously created.
Example: <p:processor name="oxf:zip"> <p:input name="data"> <files file-name="my-data.zip"> <file name="file1.txt">file:///tmp/somefile.txt</file> <file name="dir/file2.txt">file:///tmp/someotherfile.txt</file> </files> </p:input> <p:output name="data" id="zip"/></p:processor>Unzip processorThe Unzip processor uncompresses a zip file. Each file in the zip file is uncompressed to a temporary file, which is deleted at the end of the request.
For instance, assuming the zip file is uploaded to a service, and the file is stored in the instance as an URI, you'll want to first read the file with the URL generator before you uncompress it: <p:processor name="oxf:url-generator"> <p:input name="config" transform="oxf:xslt" href="#instance"> <config xsl:version="2.0"> <url> <xsl:value-of select="/instance/file"/> </url> <content-type>multipart/x-zip</content-type> </config> </p:input> <p:output name="data" id="zip"/></p:processor><p:processor name="oxf:unzip"> <p:input name="data" href="#zip"/> <p:output name="data" id="zip-file-list"/></p:processor>The format of the unzip data output is the similar to the format of the zip data input, but you get to additional pieces of information about each file: its size (size attribute) and its data and time (dateTime attribute). For instance, the output can look as follows:<files> <file name="file1.txt" size="123" dateTime="2007-09-11T18:23:04">file:///tmp/somefile.txt</file> <file name="dir/file2.txt" size="456" dateTime="2007-09-11T18:23:04">file:///tmp/someotherfile.txt</file></files> |