[XQZone General] invoking xdmp:invoke()

Howard Katz hkatz at maketechnologies.com
Thu Dec 15 11:51:50 PST 2005


Thanks Andy, 
That helps too. So invoke( ) is more or less the file-based equivalent of eval( ) then.
Howard

> -----Original Message-----
> From: general-bounces at xqzone.marklogic.com [mailto:general-
> bounces at xqzone.marklogic.com] On Behalf Of Andy Townsend
> Sent: Thursday, December 15, 2005 10:30 AM
> To: General XQZone Discussion
> Subject: Re: [XQZone General] invoking xdmp:invoke()
> 
> 
> 
> 
> Hi Howard,
> 
> Basically xdmp:invoke() simply executes a module in the same fashion that
> xdmp:eval() executes code but the code is contained within a module rather
> than a string.
> 
> Think of xdmp:invoke() as the equivalent of the operation that the
> MarkLogic HTTP server does  when you send a request to it, i.e. when you
> hit a URL like this:
> 
> http://localhost:8099/myapp/mycode.xqy
> 
> then the MarkLogic Http server looks for a code module at
> "/myapp/mycode.xqy" and if it finds one then invokes it.  xdmp:invoke gives
> you the same sort of control.
> 
> As a simple test, assuming you have CQ installed:  Just try:
> 
>     xdmp:invoke("/cq/cq.xqy")
> 
> You might use it if you had organised your code into modules and you wished
> to execute one in the same was as if it were a function, or perhaps to
> achieve a similar effect to redirecting a user using
> xdmp:redirect-response() to a different module - similar but not the same
> in that you code gets to catch and handle the output of the module rather
> than it being sent back to the users browser.
> 
> Any help?
> 
> Andy
> |-----------------------------+-------------------------------------------|
> |   "Howard Katz"             |                                           |
> |   <hkatz at maketechnologies.co|                                           |
> |   m>                        |                                         To|
> |   Sent by:                  |                            <general at xqzone|
> |   general-bounces at xqzone.mar|                            .marklogic.com>|
> |   klogic.com                |                                         cc|
> |                             |                                           |
> |   15/12/2005 18:17          |                                    Subject|
> |                             |                            [XQZone        |
> |         Please respond to   |                            General]       |
> |          General XQZone     |                            invoking       |
> |            Discussion       |                            xdmp:invoke()  |
> |      <general at xqzone.marklog|                                           |
> |              ic.com>        |                                           |
> |                             |                                           |
> |                             |                                           |
> |                             |                                           |
> |                             |                                           |
> |-----------------------------+-------------------------------------------|
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Can someone construct or point me to a example of how to use
> xdmp:invoke(), showing both some invoking code and a simple module
> that's invoked? I'm trying to understand the concept and am unable to
> come up with anything that works.
> TIA,
> Howard
> 
> _______________________________________________
> General mailing list
> General at xqzone.marklogic.com
> http://xqzone.com/mailman/listinfo/general
> 
> 
> ######################################################################
> 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.
> ######################################################################
> _______________________________________________
> General mailing list
> General at xqzone.marklogic.com
> http://xqzone.com/mailman/listinfo/general



More information about the General mailing list