xquery try/catch block
Added by Anonymous over 14 years ago
Legacy ID: #8626806 Legacy Poster: https://www.google.com/accounts ()
hi I am trying to make an try/catch block, and in zorba it works, but I need to make it in saxon. "try/catch expressions are not allowed in XPath". [code]try { doc("nenexistent.xml") } catch * ($code) { file not found }[/code] this is expected: [code]file not found[/code] but in saxon i get: [code] Error on line 2 column 1 of test.xq: XPST0003: XQuery syntax error in # try { doc#:[/code] try/catch expressions are not allowed in XPath Static error(s) in query [java] Java Result: 2
Replies (1)
RE: xquery try/catch block - Added by Anonymous over 14 years ago
Legacy ID: #8626896 Legacy Poster: Michael Kay (mhkay)
try/catch is new in XQuery 1.1, and is not defined for use in XPath/ Saxon 9.2 implements a subset of the proposed syntax, described here: http://www.saxonica.com/documentation/using-xquery/xquery11support/trycatch.html To use it you must specify xquery version 1.1 in the query prolog, and also enable XQuery 1.1 support in the API or command line; and you must be using Saxon-PE or Saxon-EE.
Please register to reply