Hi Florent, A couple of things here:
* The return type in the doc for xdmp:get-request-field is wrong--it should be item()*. We will work to correct that. * The type of node will in most cases depend on the mimetype, which for the file types will be based on its extension. For a list of mimetypes, you can look in the Admin Interface (and you can change and add things there too). The mimetype along with its default document type ought to be enough let you know what to expect (I think...). * as far as decoding a binary node, I don't think you can do that unless you know what type of binary it is. From MarkLogic's pov, it is just a bunch of bits. Hope that helps. -Danny -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Florent Georges Sent: Sunday, September 16, 2012 8:23 AM To: Florent Georges; Joshua David Ewell; MarkLogic Developer Discussion; MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] xdmp:get-request-field documentation Hi, After more tests on xdmp:get-request-field() when the field is a file field (from a "file" type of HTML form input), it seems the returned value is always either: - a binary node (instance of binary()) - or a document node with a text node as content (instance of document-node() and fn:exists($file/text())) Unfortunately this is not documented in the MarkLogic documentation, so I don't know which logic is applied to choose between both cases. So two questions: 1/ is this logic documented somewhere? 2/ is there any way to get a text node or a string from a binary node? (that is, how to "decode" the binary?) Regards, -- Florent Georges http://fgeorges.org/ http://h2oconsulting.be/ Florent Georges wrote: > Joshua David Ewell wrote: > > Hi, > >>>> xdmp:get-request-field returns the named request field as a string. > >>> Thank you. But I just tried and "instance of xs:string" >>> returns false whilst "instance of binary()" returns false... > >> The documentation shows that the result from xdmp:get-request-field >> returns a string or nothing, hence the * in "as string*". It is a >> thought, but it may be possible that the request field is returning >> nothing and that is why you may be getting false in both test >> cases. > > Oops... Sorry, I made a "typo" in my previous email, I DO GET > TRUE for the expression "instance of binary()". > > Sorry, that was confusing, to say the least :-/ > > Regards, > > -- > Florent Georges > http://fgeorges.org/ > http://h2oconsulting.be/ _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
