Loading TOC...


   $separator as String,
   $data as binary(),
   [$options as Node]
) as ValueIterator


Extract the parts from a multipart encoding. The first item in the sequence is a manifest, and the remaining items are the decoded parts.

An attempt will be made to determine the type of content based on headers such as the part's content-type. If possible, an element will be returned, falling back to an xs:string, and finally binary().

The options control how the parts are unpacked, and are similar to xdmp:zip-get - default-namespace, repair, format, default-language, and encoding. The options apply to all parts, so specifying a format of binary will cause all parts to be returned as binary, and specifying text will cause all parts to be returned as xs:string if possible, falling back to binary() if necessary. This is useful if different parts need different options, in which case the resulting strings can each be passed to xdmp:unquote() with appropriate options.

$separator The string that is to be used as a separator.
$data The data (as a binary node) to be decoded.
$options Decode options.


var html = xdmp.unquote('<html><p>Some stuff in an .html document</p></html>')
var xml = xdmp.unquote('<root> \n\
                          <a>Some other stuff in a .xml document</a> \n\
var json = xdmp.toJSON(["a",false]);
var boundaryString = "gc0p4Jq0M2Yt08jU534c0p";
var manifest = xdmp.unquote(
+   '<part><headers>'
+     '<Content-Type>application/xml</Content-Type>'
+     '<boundary>gc0p4Jq0M2Yt08jU534c0p</boundary>'
+      '</headers>'
+    '</part>'
+    '<part><headers><Content-Type>text/html</Content-Type> </headers></part> '
+    '<part><headers><Content-Type>application/json</Content-Type></headers></part>'
+ '</manifest>').next().value.root
var mpe = xdmp.multipartEncode(
   [xml,html,json] );
xdmp.multipartDecode(boundaryString, mpe);
    "headers": {
                 "Content-Type": "application/xml",
                 "boundary": "gc0p4Jq0M2Yt08jU534c0p",
                 "Content-Length": "148"
    "headers": {
                 "Content-Type": "text/html",
                 "Content-Length": "90"
    "headers": {
                 "Content-Type": "application/json",
                 "Content-Length": "12"
<?xml version="1.0" encoding="UTF-8"?>
<root><a>Some other stuff in a .xml document</a></root>
<?xml version="1.0" encoding="UTF-8"?>
<html><p>Some stuff in an .html document</p></html>
["a", false]


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