Loading TOC...

MarkLogic Server 11.0 Product Documentation
xdmp:gunzip

xdmp:gunzip(
   $gzipnode as binary(),
   $options as (element()|map:map)?
) as node()+

Summary

Get a node from a gzip node. Gunzips and returns the file in memory as a document node (for XML and JSON formats), a text node (for text formats), or a binary node (for binary formats). The format is determined by the format option.

Parameters
gzipnode The gzip node.
options Options with which to customize this operation. You can specify options as either an XML element in the "xdmp:gunzip" namespace, or as a map:map. The options names below are XML element localnames. When using a map, replace the hyphens with camel casing. For example, "an-option" becomes "anOption" when used as a map:map key. This function supports the following options:

<default-namespace>

(XML only) The namespace to use if there is no namespace at the root node of the document. The default value is "".

<repair>

A value of full specifies that malformed XML content be repaired. A value of none specifies that malformed XML content is rejected. If no repair option is explicitly specified, the default is implicitly specified by the

version of XQuery of the caller. In XQuery 1.0 and 1.0-ml the default is none. In XQuery 0.9-ml the default is full.

This option has no effect on binary, text or JSON documents.

<format>

A value of text specifies to get the document as a text document, regardless of the URI specified. A value of binary specifies to get the document as a binary document, regardless of the URI specified. A value of xml specifies to get the document as an XML document, regardless of the URI specified. A value of json specifies to get the document as a JSON document, regardless of the URI specified.

<default-language>

(XML only) The language to specify in an xml:lang attribute on the root element node if the root element node does not already have an xml:lang attribute. If this option is not specified, then nothing is added to the root element node.

<encoding>

Specifies the encoding to use when reading the document into MarkLogic Server. The value must either be "auto" or match an encoding name according to the Unicode Charset Alias Matching rules (http://www.unicode.org/reports/tr22/#Charset_Alias_Matching). When the value is "auto", MarkLogic guesses the encoding from the document content. For a list of character set encodings by language, see Collations and Character Sets By Language in the Search Developer's Guide. If you do not set this option, MarkLogic uses the encoding specified in the HTTP headers, if present. If you do not set this option and no encoding is available from HTTP headers, the encoding defaults to UTF-8. For more details, see Character Encoding in the Search Developer's Guide.

Usage Notes

You must tell the format of the node after gunzipping. You need to specify a format in the options node

Example

xdmp:gunzip(fn:doc("/gzip/tmp.gz"),
  <options xmlns="xdmp:zip-get">
    <format>xml</format>
  </options>)

=> the gunzip node from the "/gzip/tmp.gz" gzip node

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.