<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.load.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.load</api:function-name><api:suggest>xdmp.load</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>load</api:suggest><api:function-link mode="xquery" fullname="xdmp:load">/apidoc/8.0/xdmp:load.xml</api:function-link><api:function mode="javascript" name="load" type="builtin" lib="xdmp" category="UpdateBuiltins" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.load"><api:summary>
  [DEPRECATED: use <a href="./xdmp:document-load" xmlns="http://www.w3.org/1999/xhtml"><code>xdmp:document-load</code></a>
  instead]
  Inserts a new document from the XML file at $path if a document
  with the specified URI does not already exist. Otherwise, the
  function replaces the content in the existing document as an update
  operation.
</api:summary><api:params><api:param name="path" type="xs:string"><api:param-description>
    The path to the input file.  The path can be fully qualifed or relative.
    Relative pathnames are resolved from the directory in which
    MarkLogic Server is installed.
  </api:param-description><api:param-name>path</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="uri" type="xs:string?" optional="true"><api:param-description>
    The URI of the document to be loaded.
    If omitted, then the pathname is used.
  </api:param-description><api:param-name>uri</api:param-name><api:param-type>String?</api:param-type></api:param><api:param class="javascript" name="permissions" type="Object[]" optional="true"><api:param-description>
    Security permission objects corresponding to the permissions
    for the document. If not supplied, the current user's default
    permissions are applied.  The default value used for $permissions
    can be obtained by calling xdmp:default-permissions(). To specify
    no permissions, enter the empty sequence ().
  </api:param-description><api:param-name>permissions</api:param-name><api:param-type>Object[]</api:param-type></api:param><api:param name="collections" type="xs:string*" optional="true"><api:param-description>
    The collection URIs for collections to which this document
    belongs.  If not supplied, the document is added to the current
    user's default collections.  The default value used for $collections
    can be obtained by calling xdmp:default-collections(). To specify
    no collections, enter the empty sequence ().
  </api:param-description><api:param-name>collections</api:param-name><api:param-type>String[]</api:param-type></api:param><api:param name="quality" type="xs:int?" optional="true"><api:param-description>
    The quality of this document.  A positive value increases
    the relevance score of the document in text search functions.
    The converse is true for a negative value.  The default value is 0.
  </api:param-description><api:param-name>quality</api:param-name><api:param-type>xs.int?</api:param-type></api:param><api:param name="default-namespace" type="xs:string?" optional="true"><api:param-description>
    If $default-namespace is specified and the root node of the
    loaded document does not explicitly specify a namespace,
    $default-namespace will be applied to the root node.
    The default value for $default-namespace is "".
  </api:param-description><api:param-name>default-namespace</api:param-name><api:param-type>String?</api:param-type></api:param><api:param name="options" type="xs:string*" optional="true"><api:param-description>
    The options for loading this document.
    The default value is ().
    <p xmlns="http://www.w3.org/1999/xhtml">Options include:</p>
    <blockquote xmlns="http://www.w3.org/1999/xhtml"><dl>
    <dt>"repair-full"</dt>
    <dd>Specifies that malformed XML content be repaired during loading.
        This option has no effect on binary or text documents.</dd>
    <dt>"repair-none"</dt>
    <dd>Specifies that malformed XML content be rejected during loading.
        This option has no effect on binary or text documents.</dd>
    <dt>"format-text"</dt>
    <dd>Specifies to load the document as a text document,
        regardless of the URI specified.</dd>
    <dt>"format-binary"</dt>
    <dd>Specifies to load the document as a binary document,
        regardless of the URI specified.</dd>
    <dt>"format-xml"</dt>
    <dd>Specifies to load the document as an XML document,
        regardless of the URI specified.</dd>
    <dt>"format-json"</dt>
    <dd>Specifies to load the document as a JSON document,
        regardless of the URI specified.</dd>
    <dt>"lang=en"</dt>
    <dd>Specifies that the document is in english.</dd>
    </dl></blockquote>
  </api:param-description><api:param-name>options</api:param-name><api:param-type>String[]</api:param-type></api:param><api:param name="forest-ids" type="xs:unsignedLong*" optional="true"><api:param-description>
    Specifies the ID of the forest in which this document is inserted.
    If the document already exists in the database, it will remain in
    its existing forest.  If no such forest exists or if no such forest
    is attached to the context database, an error is raised.  If
    multiple forests are specified, the document is inserted into
    one of the specifed forests.
    <p xmlns="http://www.w3.org/1999/xhtml">
    If you have local disk failover enabled, specify the ID of the master 
    forest.
    In the event of a failover, MarkLogic server will automatically redirect 
    documents
    to the replica forest.  Specify the ID of the replica forest will result 
    in a "forest not in database" error.
    </p>
  </api:param-description><api:param-name>forest-ids</api:param-name><api:param-type>String[]</api:param-type></api:param></api:params><api:return>null</api:return><api:privilege>
  <p xmlns="http://www.w3.org/1999/xhtml"><code>http://marklogic.com/xdmp/privileges/xdmp-load</code></p>
  <p xmlns="http://www.w3.org/1999/xhtml">If a new document is inserted, you also need the
  <code>unprotected-uri</code> privilege (only if the URI is not protected),
  the <code>any-uri</code> privilege, or an appropriate URI privilege. </p>
</api:privilege><api:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">If no format is specified in $options, it is specified by the
  document content type specified by the extension of the document URI.
  The mimetype extensions and corresponding content types are set in the
  Admin Interface.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">If neither "repair-full" nor "repair-none" is present,
  the default is specified by the XQuery version of the caller.
  In XQuery version <code>1.0</code> and <code>1.0-ml</code> the default is
  "repair-none".  In XQuery version <code>0.9-ml</code> the default is
  "repair-full".</p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
declareUpdate();
xdmp.load("/home/test/example.json", "/example.json",
          [xdmp.permission("editor", "read"),
           xdmp.permission("editor", "update")],
          "http://examples.com",
          10,"http://www.marklogic.com/default")
</pre></api:example><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
declareUpdate();
xdmp.load("/home/test/example.json",
            "/example.json",
            xdmp.defaultPermissions(),
            xdmp.defaultCollections(),
            0,
            "",
            "repair-none");
</pre></api:example></api:function></api:function-page>