Have a look at this thread on the MarkLogic Dev mailing list, which contains interesting info on that regard.