Re: p:exec and binary result

"vojtech.toman@emc.com" <vojtech.toman@emc.com> writes:
> The specification of p:exec says that:
>
> "The standard output of the command is read and returned on result;
> the standard error output is read and returned on errors. In order to
> assure that the result will be an XML document, each of the results
> will be wrapped in a c:result element."
>
> What if the command produces binary (non-text) data on the standard output?

There's nothing comparable to a media type for the results that appear
From p:exec, so without an extra flag somewhere, I don't think p:exec
can do anything useful. (A quick peek at XML Calabash reveals that it
treats anything that isn't XML as if it was text and attempts to
encode the bytes.)

I suppose that with a set of "*-as-binary" attributes, the results
could be base64 encoded (and the input(s) base64 decoded, I suppose).

My two cents:

1. I think the step is implicitly geared towards text outputs, not binary.
   We don't say anything about binary and "wrap-result-lines" suggests pretty
   strongly that we didn't think about it.
2. Even if we had a good story on binary, you'd need some sort of a flag
   to tell the step to treat the result as binary.
3. I hope that whatever our story is, it helps here.
4. I think it would be reasonable to add an extension attribute to specify
   binary output and base64 encode the results in the meantime.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676
www.marklogic.com

Received on Tuesday, 10 January 2012 00:51:36 UTC