The problem is this line:

     xquery version "1.0";

Instead use:

     xquery version "1.0-ml";

Try/catch blocks are part of the MarkLogic extensions to XQuery and are not 
available with standard XQuery 1.0.

Doug Glidden
Software Engineer
The Boeing Company
[email protected]

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Pradeep Maddireddy
Sent: Wednesday, April 21, 2010 11:52
To: General
Subject: [MarkLogic Dev General] Problem with xdmp:invoke module

Hi..!

Can some one tell me whats wrong with this Query

try
{
xdmp:document-load("/abc.xml")
}
catch  ($e)
{
<span>Problem loading </span>
}

When I run it in cq it works fine. When I create test_trycatch.xqy file with 
the same query and invoke it using xdmp: invoke I get the following error

[1.0] XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected 
Lbrace_, expecting $end

test_trycatch.xqy content
--------------------------------------------------------------------------------------------
xquery version "1.0";
declare namespace xdmp="http://marklogic.com/xdmp";;

try
{
xdmp:document-load("/abc.xml")
}
catch  ($e)
{
<span>Problem loading </span>
}
--------------------------------------------------------------------------------------------
Invoking from cq as follows

xquery version "1.0";
declare namespace xdmp="http://marklogic.com/xdmp";;
xdmp:invoke("test_trycatch.xqy")
--------------------------------------------------------------------------------------------

Thanks in advance

Pradeep Maddireddy
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to