Erik Hennum wrote:
Hi,
> You're right, MarkLogic doesn't provide a public XQuery API that
> supports multipart/mixed (for instance).
Thank you. This does not solve my problem per se, but at least
I know it is not supported, and I can say multipart is not
supported till MarkLogic supports it in a future version.
> That feature is under consideration for a future release. Other
> than the obvious (encode and decode multipart/mixed when sending
> or receiving a payload), do you see any nuances in the use case?
What I need to do is to be able to access each part individually
as well as their "headers" (or "pseudo-headers", I am not sure how
they are defined by the RFCs). See the example below...
> By the way, the resource extension capability of the REST API
> does let a REST client send or receive multipart/mixed, which is
> passed to or returned from the XQuery extension as a sequence of
> documents.
> So, that might provide a supported solution in the interim.
I am not sure. Does that mean the endpoint has to be changed?
Especially in the way it is accessed? What are the typical
changes to apply to, say, the following query which serves a HTTP
request in the usual way, in a MarkLogic HTTP Server (in the
query itself, as well as any config options, like how the request
maps to it):
xquery version "1.0-ml";
<results> {
for $b in xdmp:get-request-body()
return
<result> {
(: Transform binary() to xs:base64Binary :)
(: To avoid type error, cannot add binary() to element :)
if ( $b instance of document-node() and
$b/node() instance of binary() ) then
xs:base64Binary($b/node())
else
$b
}
</result>
}
</results>
Regards,
--
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
Example. Given the example given in section 5.2 of RFC 2387 at
http://tools.ietf.org/html/rfc2387#section-5.2:
Content-Type: Multipart/Related; boundary=example-2;
start="<[email protected]>"
type="Text/x-Okie"
--example-2
Content-Type: Text/x-Okie; charset=iso-8859-1;
declaration="<[email protected]>"
Content-ID: <[email protected]>
Content-Description: Document
{doc}
This picture was taken by an automatic camera mounted ...
{image file=cid:[email protected]}
{para}
Now this is an enlargement of the area ...
{image file=cid:950118:[email protected]}
{/doc}
--example-2
Content-Type: image/jpeg
Content-ID: <[email protected]>
Content-Transfer-Encoding: BASE64
Content-Description: Picture A
[encoded jpeg image]
--example-2
Content-Type: image/jpeg
Content-ID: <[email protected]>
Content-Transfer-Encoding: BASE64
Content-Description: Picture B
[encoded jpeg image]
--example-2--
I need to be able to ouput:
- Headers:
Content-Type: Multipart/Related; boundary=example-2;
start="<[email protected]>" type="Text/x-Okie"
- Part #1:
= Pseudo-headers:
Content-Type: Text/x-Okie; charset=iso-8859-1;
declaration="<[email protected]>"
Content-ID: <[email protected]>
Content-Description: Document
= Content (text node):
{doc}
This picture was taken by an automatic camera mounted ...
{image file=cid:[email protected]}
{para}
Now this is an enlargement of the area ...
{image file=cid:950118:[email protected]}
{/doc}
- Part #2
= Pseudo-headers:
Content-Type: image/jpeg
Content-ID: <[email protected]>
Content-Transfer-Encoding: BASE64
Content-Description: Picture A
= Content (xs:base64Binary):
[encoded jpeg image]
- Part #3
= Pseudo-headers:
Content-Type: image/jpeg
Content-ID: <[email protected]>
Content-Transfer-Encoding: BASE64
Content-Description: Picture B
= Content (xs:base64Binary):
[encoded jpeg image]
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general