Project

Profile

Help

Filename into error messages for s9api

Added by Anonymous almost 16 years ago

Legacy ID: #5284994 Legacy Poster: David Lee (daldei)

What is the recommended way of getting the filename of XQuery or XSLT files into the debug output (stack trace output) for Saxon using s9API. Here's sample output: Error on line 55 of module with no systemId: XPST0017: Cannot find a matching 0-argument function named {http://schemas.epocrates.com/schemas/xquery/dx}popheight() Cannot find a matching 0-argument function named {http://schemas.epocrates.com/s chemas/xquery/dx}popheight() net.sf.saxon.s9api.SaxonApiException: Cannot find a matching 0-argument function named {http://schemas.epocrates.com/schemas/xquery/dx}popheight() at net.sf.saxon.s9api.XQueryCompiler.compile(XQueryCompiler.java:230) at org.xmlsh.commands.xquery.run(xquery.java:109) ... Here's the code I'm using (snippet) XQueryCompiler compiler = processor.newXQueryCompiler(); String query = Util.readString( env.getShell().getFile(fname)); XQueryExecutable expr = compiler.compile( query ); XQueryEvaluator eval = expr.load(); Serializer dest = new Serializer(); dest.setOutputProperty( Serializer.Property.OMIT_XML_DECLARATION, "yes"); dest.setOutputStream(env.getStdout()); eval.run(dest); -------------------- Is there a way to get the XQuery file name into the debug output ? Clearly saxon doesnt know where I got the XQuery string from my first line ... so is there a property I can set or call to make to tell it the filename for debug purposes ? Thanks for any suggestions.


Replies (1)

RE: Filename into error messages for s9api - Added by Anonymous almost 16 years ago

Legacy ID: #5286912 Legacy Poster: Michael Kay (mhkay)

You can call setBaseURI() on the XQueryCompiler. Alternatively use the compile(File f) method to compile a query held in a file.

    (1-1/1)

    Please register to reply