Thanks, this works (I overlooked the "configure" checkbox on the web page); I could successfully compile and run your code.
The numerous imports in the Java source file seem to indicate that it won’t be straightforward to do something similar for BaseX, right? But maybe I’m wrong – if you have time to give it a try, all your questions will be welcome!
Christian
On Wed, Mar 30, 2016 at 5:57 PM, Gunther Rademacher grd@gmx.net wrote:
Hi Christian,
This sounds interesting indeed! Could you provide us with a link to the Saxon extension functions?
it's an option when generating a parser in Java on the REx website, http://bottlecaps.de/rex/
For parsing XQuery from XQuery via a Saxon extension function,
- download the XQuery grammar, e.g.
http://bottlecaps.de/rex/CR-xquery-31-20151217.ebnf
generate a Java-coded parser from it, using these command line options
-java -tree -saxon
compile the result
javac CR_xquery_31_20151217.java
register the extension function, e.g. using the generated Saxon
initializer class:
java net.sf.saxon.Query
-init:CR_xquery_31_20151217$SaxonInitializer -qs:"declare namespace p='CR_xquery_31_20151217'; p:parse-XQuery('42')" !indent=yes
The Saxon API that is used for building the parse tree has changed recently, so be sure to use Saxon 9.7.0.4 or later.
Best regards Gunther