on 04-20-2010 6:58 PM
Hello Experts,
I'm trying to get ajavax.xml.transform.sax.TransformerHandler in a java Messagemapping. The Transformerfactory if get from SAXTransformerFactory.newInstance() in the Mapping Runtime however is of the type com.sap.aii.ib.server.mapping.execution.jaxpfactories.MappingTransformerFactory which does not provide the newTransformerHandler() as javax.xml.transform.sax.SAXTransformerFactory.
I'm using PI 7.1. How can I get the TransformerHandler in a Java Mapping?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
use
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
factory = new com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl();
instead of
SAXTransformerFactory factory =
(SAXTransformerFactory) SAXTransformerFactory.newInstance();
It should work fine.
Although class SAXTransformerFactory is designed to provide SAX-specific factory methods, it doesn't override newInstance() method (in fact there can be no overriding since this method is static, I mean defining the same method), that's why in fact it can return any TransformerFactory and you will get ClassCastException when try to cast to SAXTransformerFactory. Method newInstance() of class TransformerFactory at first looks for implementation class in system properties and then uses other ways in case of no success. If nothing is found, eventually class com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl is used.
I can assume that system property "javax.xml.transform.TransformerFactory" is set to "com.sap.aii.ib.server.mapping.execution.jaxpfactories.MappingTransformerFactory" by default during PI 7.1 installation. And class com.sap.aii.ib.server.mapping.execution.jaxpfactories.MappingTransformerFactory doesn't extend SAXTransformerFactory class.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.