Project

Profile

Help

changing the default parser in saxon

Added by Anonymous about 19 years ago

Legacy ID: #3421157 Legacy Poster: gyskouras (gyskouras)

Hi, I am trying to find out a way to change the default parser used by Saxon. The documentation says that you can use the -x and -y command line arguments to do that. I did not see any such arguments in running the saxon engine! I have donwloaded the last version of Saxon. I am running it as: java -cp saxon8.jar net.sf.saxon.Query -t -s samples\data\books.xml samples\query\books-to-html.xq >c:\temp.html The -x and -y arguments are not accepted. Even in the sources (Query.java) there is no support for these arguments. Please can somebody let me know how to run saxon with xerces parser for example? Thanks.


Replies (2)

RE: changing the default parser in saxon - Added by Anonymous about 19 years ago

Legacy ID: #3422199 Legacy Poster: gyskouras (gyskouras)

I mean, I did not find any argument option to change the parser for the XQuery engine. (net.sf.saxon.Query) The XSLT engine allows -x and -y options (net.sf.saxon.Transform). I'd appreciate if somebody can show how to do the same for the Saxon XQuery engine. Thanks.

RE: changing the default parser in saxon - Added by Anonymous about 19 years ago

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

The -x and -y arguments are available on the XSLT command line but not the XQuery command line. Saxon by default loads a parser using the JAXP ParserFactory, so you can set the parser to be loaded using the JAXP mechanisms. Specifically, set the system property javax.xml.parsers.SAXParserFactory to the full name of a class that implements the SAXParserFactory interface - see the JavaDoc for SAXParserFactory for details. If you want this level of control it may be best to write your own Java class to drive the query. You then have access to all the methods available on the Saxon Configuration object, notably setSourceParserClass(). Alternatively, you can write a URIResolver to handle requests for source documents, and this can return a SAXSource containing a fully-configured XMLReader. This allows you not only to choose the parser to be used, but also to set configuration options on the parser. Michael Kay

    (1-2/2)

    Please register to reply