synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From detelinyorda...@gmail.com
Subject Synapse 1.2 XSLTMediator cannot work with Saxon in non-DOM mode
Date Fri, 27 Mar 2009 16:02:55 GMT
Hi guys,
   We are trying to use Synapse 1.2 using Saxon 8.9 transformer provider
(instead of Xalan) but we getting an exception when using the XSLTMediator
in stax mode.

We tried to run the Synapse 1.2 core tests setting
javax.xml.transform.TransformerFactory to
"net.sf.saxon.TransformerFactoryImpl" to see whether they will work, but the
XSLTMediatorTest fails with the same exception:

Running org.apache.synapse.mediators.transform.XSLTMediatorTest
- Fatal error occured in the XSLT transformation :
net.sf.saxon.trans.DynamicError: The SAX2 parser does not support setting
the 'namespaces' feature to true
- Error performing XSLT transformation using : xslt-key
net.sf.saxon.trans.DynamicError: The SAX2 parser does not support setting
the 'namespaces' feature to true
        at net.sf.saxon.event.Sender.configureParser(Sender.java:357)
        at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:241)
        at net.sf.saxon.event.Sender.send(Sender.java:142)
        at net.sf.saxon.event.Sender.send(Sender.java:43)
        at net.sf.saxon.Controller.transform(Controller.java:1504)
        at
org.apache.synapse.mediators.transform.XSLTMediator.performXSLT(XSLTMediator.java:319)
        at
org.apache.synapse.mediators.transform.XSLTMediator.mediate(XSLTMediator.java:177)
        at
org.apache.synapse.mediators.transform.XSLTMediatorTest.testTransformXSLTCustomSource(XSLTMediatorTest.java:88)

It seems that by default these tests are run using the Xalan transformer and
the problem does not appear, but if adding the system property in the Maven
surefire plugin configuration you should be able to reproduce it:

<systemProperties>
     <property>
         <name>javax.xml.transform.TransformerFactory</name>
         <value>net.sf.saxon.TransformerFactoryImpl</value>
     </property>
</systemProperties>

The problem seems to be that when configuring the parser (which in stax mode
seems to be an instance of
org.springframework.xml.stream.StaxStreamXmlReader), Saxon is trying to set
the following features:

- http://xml.org/sax/features/namespaces
- http://xml.org/sax/features/namespace-prefixes

Unfortunately Spring's StaxStreamXmlReader always throws a
SAXNotRecognizedException in its setFeature method:

See the javadocs:
http://static.springframework.org/spring-ws/sites/1.5/apidocs/org/springframework/xml/stream/AbstractStaxXmlReader.html#setFeature(java.lang.String,%20boolean)

Regards,
   Detelin

Mime
View raw message