[XQZone General] Question 2 (and 3, and 4 :)

Raffaele Sena raff at aromatic.org
Fri Jun 10 18:27:27 PDT 2005


In theory I should know this, but I forgot...

- How do I know if a document is actually a directory ? (fn:node-kind 
returns document, xdmp:uri-content-type returns unknown content type, 
xdmp:uri-format returns binary, but the last two probably just look at 
the file extension).

  Once I know the document is a directory I guess I can use the 
xdmp:directory-* functions to get files and stuff.

- How do I "deliver" the content of a binary file through MarkLogic ?
  empty(doc($image-file)) returns empty. I know last year Ron or Ian 
showed how to do this, but my memory... :)

For my next question I may have a possible  answer. I am trying to store 
xml, html and image files into MarkLogic and retrieve them using the embedded HTTP 
server.

Unless there is a trick that I don't know I can't retrieve those files 
without going through a query in an .XQY file (i.e. I need an .xqy page 
that gets a path in input and return the document content in output even 
if I don't need to do any processing).

And I was asking about directories only because I was trying to be smart 
and have the .xqy page act as a database browser if I don't pass any 
document URI.

Anyway, one think that I just noticed by tring to return files that the 
browser doesn't know how to display (the .xqy files that are stored in the 
same document database). When IE asks if I want to save the file that the 
server is returning it's always showing me the .xqy page (in my case 
view.xqy) because the document URI is a query parameter.

I think I can "fix" this by setting the "Content-Disposition" header that 
I think allows to specify a filename. I'll try and report.


...I have a few more question related to document size (so that I can set 
the Content-Length), a "conversion" tool that given some image files will 
either create an XML file containing info about the image (width, height, 
etc.) or will create appropriate properties attached to the document, 
support for chunked encoding (or returning large documents, or the output 
of a large query is going to be painful) but I'll save them for later :)

-- Raffaele




More information about the General mailing list