According to the javadoc this is how the factory operates:
- Use the javax.xml.stream.XMLOutputFactory system property.
- Use the properties file "lib/stax.properties" in the JRE directory.
- Use the Services API (as detailed in the JAR specification)
- Platform default XMLOutputFactory instance.
So to be sure to use the sun internal implementation, I think the best way is to do the following:
System.setProperty("javax.xml.stream.XMLOutputFactory", "com.sun.xml.internal.stream.XMLOutputFactoryImpl");
XMLOutputFactory.newInstance();