<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.zipGet.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.zipGet</api:function-name><api:suggest>xdmp.zipget</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>zipget</api:suggest><api:function-link mode="xquery" fullname="xdmp:zip-get">/apidoc/8.0/xdmp:zip-get.xml</api:function-link><api:function mode="javascript" name="zipGet" type="builtin" lib="xdmp" category="Document Conversion" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.zipGet"><api:summary>
  Get a named file from a zip document. Unzips 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).
  The format is determined either
  by the mimetype from the file name or by the <code xmlns="http://www.w3.org/1999/xhtml">format</code> option.
</api:summary><api:params><api:param name="zipfile" type="binary()" optional="false"><api:param-description>
    The zip file.
  </api:param-description><api:param-name>zipfile</api:param-name><api:param-type>binary()</api:param-type></api:param><api:param name="name" type="xs:string" optional="false"><api:param-description>
    The path to the zip file as shown in the zip manifest.
  </api:param-description><api:param-name>name</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="options" type="(element()|map:map)?" optional="true"><api:param-description>
    The options 
                <span class="javascript" xmlns="http://www.w3.org/1999/xhtml">object</span>
    for getting this zip file.
    
    <span class="javascript" xmlns="http://www.w3.org/1999/xhtml">The default value is null. </span>
    <p xmlns="http://www.w3.org/1999/xhtml">The 
           <code class="javascript">xdmp.zipGet</code> options include:</p>
    <blockquote xmlns="http://www.w3.org/1999/xhtml"><dl>
    <dt>
      <p class="javascript">defaultNamespace</p>
    </dt>
    <dd>(XML only) The namespace to use if there is no namespace at the root node of
    the document. The default value is "".</dd>

    
    <dt class="javascript"><p>repair</p></dt>
    <dd>A value of <code>full</code> specifies that malformed XML
        content be repaired.  A value of <code>none</code> specifies that
        malformed XML content is rejected. If no repair option is explicitly specified, 
        the default is implicitly specified by the 
        
        <p class="javascript">language of the caller. From JavaScript, 
        if no repair option is explicitly specified, the default is <code>none</code>.</p>
        This option has no effect on binary, text or JSON documents.</dd>
    <dt><p>
           <span class="javascript">format</span></p></dt>
    <dd>A value of <code>text</code> specifies to get the document as a
        text document, regardless of the URI specified. A value of
              <code>binary</code> specifies to get the document as a binary
              document, regardless of the URI specified. A value of <code>xml</code>
        specifies to get the document as an XML document, regardless of the
              URI specified. A value of <code>json</code> specifies to get the document
              as a JSON document, regardless of the URI specified.</dd>
    <dt><p>
           <span class="javascript">defaultLanguage</span></p></dt>
    <dd>(XML only) The language to specify in an <code>xml:lang</code> attribute on the
    root element node if the root element node does not already have an
    <code>xml:lang</code> attribute. If 
    
    <span class="javascript"><code>defaultLanguage</code></span> is
    not specified, then nothing is added to the root element node.</dd>
    <dt><p>
           <span class="javascript">encoding</span></p>
    </dt>
    <dd>Specifies the encoding to use when reading the document into MarkLogic
    Server.  Supported values include <code>UTF-8</code> and
    <code>ISO-8859-1</code>.  All encodings will be translated into UTF-8
    from the specified encoding.  The string specifed for the
    <code>encoding</code> option will be matched to an encoding name according
    to the Unicode Charset Alias Matching rules
    (<a href="http://www.unicode.org/reports/tr22/#Charset_Alias_Matching">http://www.unicode.org/reports/tr22/#Charset_Alias_Matching</a>).
    An automatic encoding detector will be used if the value <code>auto</code>
    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, 
                            <code class="javascript">xdmp.httpGet</code>),
    otherwise it defaults
    to UTF-8; any encoding http headers are ignored if there is any
    value specified for the <code>encoding</code> option.</dd>
    </dl></blockquote>
  </api:param-description><api:param-name>options</api:param-name><api:param-type>Object?</api:param-type></api:param></api:params><api:return>ValueIterator</api:return><api:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">The name of the document you are extracting will determine the default
  format in which the document is extracted, based on the mimetype settings.
  For example, if you are extracting a document with the name
  <code>myDocument.xmlfile</code>, it will by default extract that document
  as a text document (because it is an unknown mimetype, and unknown
  mimetypes default to text format).  If you know this is an XML document,
  then specify a <code>format</code> of <code>xml</code> in the
  <code>options</code> 
                       <span class="javascript">object</span>
  (see the <a href="#zipget2">second example</a> below).</p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
xdmp.zipGet(doc("/zip/tmp.zip"), "files/myxmlfile.xml")

=&gt; the "files/myxmlfile.xml" node from the "/zip/tmp.zip" zip file

</pre></api:example><api:example class="javascript">
<pre xml:space="preserve" id="zipget2" xmlns="http://www.w3.org/1999/xhtml">
xdmp.zipGet(fn.doc("/zip/tmp.zip"), "myDocument.jsonfile",
    {
      "format" : "json"
    })
=&gt; the "myDocument.jsonfile" node from the "/zip/tmp.zip"
   zip file, as a JSON document

</pre></api:example></api:function></api:function-page>