Changes

Jump to navigation Jump to search
895 bytes added ,  21:49, 28 May 2012
no edit summary
==zip2:create==
{|width='100%'
|-
| width='90' | '''Signatures'''
==zip2:entries==
{|width='100%'
|-
| width='90' | '''Signatures'''
|-
| '''Summary'''
|Returns the entry descriptors of the given zip archive, which all contain . A descriptor contains the following attributes:* {{Code|size}}: original file size
* {{Code|last-modified}}: timestamp, formatted as xs:dateTime
* {{Code|size}}: original file size
* {{Code|compressed-size}}: compressed file size
An example:
<pre class="brush:xml">
<entry size="1840" last-modified="2009-03-20T03:30:32" compressed-size="672">
doc/index.html
</entry>
</pre>
|}
 
==zip2:extract-texts==
 
{| width='100%'
|-
| width='90' | '''Signatures'''
|{{Func|zip2:extract-texts|$zip as xs:base64Binary|xs:string*}}<br/>{{Func|zip2:extract-texts|$zip as xs:base64Binary, $entry-names as xs:string*|xs:string*}}<br/>{{Func|zip2:extract-texts|$zip as xs:base64Binary, $entry-names as xs:string*, $encoding as xs:string|xs:string*}}<br/>
|-
| '''Summary'''
|Extracts archive entries and returns them as texts.<br/>The returned entries can be limited via {{Code|$entry-names}}.<br/>The optional parameter {{Code|$encoding}} defines the encoding of the file.
|-
| '''Examples'''
|The following expression extracts all {{Code|.txt}} files from an archive:
<pre class="brush:xquery">
let $archive := file:read-binary("documents.zip")
for $entry in zip2:entries($archive)[ends-with(., '.txt')]
return zip2:extract-texts($archive, $entry)
</pre>
|}
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu