You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by fservais <fr...@approach.be> on 2002/09/24 17:21:57 UTC

is there a way to choose the sax parser used for one TraX?

Hi,

is there a way to choose the parser for an xsl transformation, I mean 
overriding the system property wich set the default saxparser.
I cannot change the default saxparser, but reallty need top use xerces 
instead for my xslt transformation. I did'nt manage to do this with all 
these factories around:


     SAXTransformerFactory saxTFactory = new 
org.apache.xalan.processor.TransformerFactoryImpl();

     XMLFilter xmlFilter1 = saxTFactory.newXMLFilter(new 
StreamSource(xslFile)); //it looks like it will use the default sax 
parser to parse the xslt source...
//  I want to use xerces instead, but just here not system wide



    XMLReader reader = XMLReaderFactory.createXMLReader();

     xmlFilter1.setParent(reader);

     ContentHandler ch = driver.getContentHandler();

     xmlFilter1.setContentHandler(ch);

     xmlFilter1.parse(new InputSource(inputReader));


Thanks a lot

FreD.


Re: is there a way to choose the sax parser used for one TraX?

Posted by Joseph Kesselman <ke...@us.ibm.com>.
If you pass in a StreamSource, Xalan uses JAXP to find the parser, so it 
should pick up whatever JAXP currently has set as its defaults. You could 
look at which parser your JAXP environment is currently set up to load...

Or, as a more directly controllable solution, you could get your own SAX 
parser (however you prefer to do so), initialize it to read from your 
stream, wrap that parser in a SAXSource and pass that to the transformer.


______________________________________
Joe Kesselman  / IBM Research