Reputation: 377
I'm using JAXP XSLT APIs (javax.xml.transform) to transform xml file.
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer(xslSource);
transformer.transform(inputSource, outputResult);
The javadoc for TransformerFactory says: It uses the following ordered lookup procedure to determine the TransformerFactory implementation class to load:
I wonder how to decide which is the default TransformerFactory instance?
Upvotes: 6
Views: 20142
Reputation: 9514
From Oracle JDK 1.7
Class javax.xml.transform.TransformerFactory
:
Default Transformer is XSLTC (originally forked from Xalan). XSLTC is the compiling version (the 'C' in XSLTC)
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
public static TransformerFactory newInstance()
throws TransformerFactoryConfigurationError {
try {
return (TransformerFactory) FactoryFinder.find(
/* The default property name according to the JAXP spec */
"javax.xml.transform.TransformerFactory",
/* The fallback implementation class name, XSLTC */
"com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
} catch (FactoryFinder.ConfigurationError e) {
throw new TransformerFactoryConfigurationError(
e.getException(),
e.getMessage());
}
}
Upvotes: 4
Reputation: 163595
"Platform" here is Java-speak for the Java compiler / runtime you are using. So the "platform default" means whatever the JDK decides. In the case of the Oracle JDK, it's a version of the Xalan XSLT 1.0 engine that's built in to the JDK. A different JDK could use a different default.
Upvotes: 6