// System.setProperty("javax.xml.stream.XMLOutputFactory", "com.bea.xml.stream.XMLOutputFactoryBase");
// System.setProperty("javax.xml.stream.XMLEventFactory", "com.bea.xml.stream.EventFactory");
// }
private XMLInputFactory createInputFactory() {
XMLInputFactory factory;
for (int i = 0; i < StAX_FACTORIES.length; i++) {
try {
factory = (XMLInputFactory) ClassLoaderUtil.newInstance(StAX_FACTORIES[i]);
setupProperties(factory);
if (DEBUG) System.err.println("using XMLInputFactory=" + factory.getClass().getName());
return factory;
} catch (IllegalArgumentException e) {
// keep on trying
} catch (NoClassDefFoundError err) {
// keep on trying
} catch (Exception err) {
// keep on trying
}
}
try { // StAX default
factory = XMLInputFactory.newInstance();
setupProperties(factory);
} catch (IllegalArgumentException ex) {
throw new XMLException(
"Could not find or create a suitable StAX parser"
+ " - check your classpath", ex);
} catch (Exception ex) {
throw new XMLException(
"Could not find or create a suitable StAX parser"
+ " - check your classpath", ex);
} catch (NoClassDefFoundError ex) {
throw new XMLException(
"Could not find or create a suitable StAX parser"
+ " - check your classpath", ex);
}
if (DEBUG) System.err.println("using default XMLInputFactory="
+ factory.getClass().getName());
return factory;
}