Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking options for xalan TransformerFactoryImpl

I m using SAX based XML parser, things are working fine but I'm getting the following warning message in log

com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl is Sun proprietary API and may be removed in a future release 
                                transformerFactory = new TransformerFactoryImpl();

I want to get rid of this, can anybody suggest me other options for TransformerFactoryImpl?

like image 465
Chinmay Avatar asked Feb 15 '26 02:02

Chinmay


1 Answers

You can use TransformerFactory.newInstance() instead:

javax.xml.transform.TransformerFactory tf =       
        javax.xml.transform.TransformerFactory.newInstance();

How it determines which implementation to load is told in Javadocs.

If it is important to keep care that you have exactly same implementation behind the scenes that you are currently using, just set following system property before obtaining TransformerFactory instance. I assume that using same implementation is convenient, as long as you get rid of error message.

System.setProperty("javax.xml.transform.TransformerFactory",          
                   "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
like image 193
Mikko Maunu Avatar answered Feb 18 '26 00:02

Mikko Maunu