Search code examples
xquerysequencepretty-printmarklogic

print out xquery sequence and exit


Is there a way to "die" in execution flow in an xquery file and output a nicely formatted printout of a sequence variable?

I'm trying something like:

return { fn:error(xs:QName("ERROR"), $xml) }

but that doesn't quite seem to work.

Thanks!


Solution

  • Based on your comment (you need it for debugging) I guess you are looking for the fn:trace function, described here http://www.xqueryfunctions.com/xq/fn_trace.html

    If you want to abort the execution flow and output an error in your application you should in fact use the XQuery exception handling.