Loading TOC...

xdmp.gunzip

xdmp.gunzip(
   $gzipnode as binary(),
   $options as Object?
) as ValueIterator

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 The options object for gunzipping this gzip document.

The xdmp.gunzip options include:

defaultNamespace

(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

language of the caller. From JavaScript, if no repair option is explicitly specified, the default is none.

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.

defaultLanguage

(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. Supported values include UTF-8 and ISO-8859-1. All encodings will be translated into UTF-8 from the specified encoding. The string specified for the encoding option will be matched to an encoding name according to the Unicode Charset Alias Matching rules (http: //www.unicode.org/reports/tr22/#Charset_Alias_Matching). An automatic encoding detector will be used if the value auto is specified. If no encoding can be detected, the encoding defaults to UTF-8. If no encoding option is specified, the encoding defaults to the encoding specified in the http header (if using with one of the http functions, for example, xdmp.httpGet), otherwise it defaults to UTF-8; any encoding http headers are ignored if there is any value specified for the encoding option.

Usage Notes

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

Example

xdmp.gunzip(fn.doc("/gzip/tmp.gz"),
  {
    "format" : "binary"
  })

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

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy