[XQZone General] Posting binary data - tricky?

atownsen at wiley.co.uk atownsen at wiley.co.uk
Tue Aug 16 07:05:41 PDT 2005




Ok smart folk..............

Platform : Mark Logic 3.0-2 on Solaris

I have binary objects in MarkLogic (e.g. a gif or jpeg image) - so far so
good.

Now I wish to use an external service on them - watermark, thumbnail
etc..... (stuff that I can't do within ML) so I want to send them via an
HTTP Post to the service.

Should be easy (and is easy with XML content) however I don't appear to be
able to put the data into the post because when I do something like:

.....
let $postData :=
        <options xmlns="xdmp:http">
                <data>
                        { $data }
                </data>
        </options>
let $result as item()+ := xdmp:http-post($url, $postData)
......

I get   XDMP-CHILDNODEKIND: $data -- element nodes cannot have binary node
children.

Ok - I understand that rule but how then can I post my binary data around
from within ML?  Can I encode it somehow/somewhere?

I have tried xdmp:quote() (since it takes item()* and I hope - though as
yet I find no docs -  a binary node should be a subtype of this) and indeed
this seems to let me put the node into <options> but I then get the error
below presumably as a part of the validation of <options> done in
xdmp:http-post.

XDMP-NOTSIMPLE: xdmp:http-post(......., /http:options) -- Node does not
have simple content: /http:options/http:data

I do concede that the docs for xdmp:http-post do state that options/data
should be a string, but then xdmp:quote() is supposed to return a string.

So anyway - just how can I post my binary content off for processing,
preferably without using unelegant write-to-the-filesystem type
work-arounds?

Thanks in advance

Andy





######################################################################
The information contained in this e-mail and any subsequent 
correspondence is private and confidential and intended solely 
for the named recipient(s).  If you are not a named recipient, 
you must not copy, distribute, or disseminate the information, 
open any attachment, or take any action in reliance on it.  If you 
have received the e-mail in error, please notify the sender and delete
the e-mail.  

Any views or opinions expressed in this e-mail are those of the 
individual sender, unless otherwise stated.  Although this e-mail has 
been scanned for viruses you should rely on your own virus check, as 
the sender accepts no liability for any damage arising out of any bug 
or virus infection.
######################################################################



More information about the General mailing list