Let's consider XMLEventFactory.newFactory(String factoryId, ClassLoader classLoader) spec excerpt: * If {@code factoryId} is "javax.xml.stream.XMLEventFactory", * use the service-provider loading facilities, defined by the * {@link java.util.ServiceLoader} class, to attempt to locate and load an * implementation of the service using the specified {@code ClassLoader}. * If {@code classLoader} is null, the {@linkplain * java.util.ServiceLoader#load(java.lang.Class) default loading mechanism} will apply: Above excerpt refers to java.util.ServiceLoader#load(java.lang.Class) method for null classLoader case. Similarly java.util.ServiceLoader#load(java.lang.Class, ClassLoader) should be referred for the case of non null classLoader; for instance like it's presented below: * If {@code factoryId} is "javax.xml.stream.XMLEventFactory", * use the service-provider loading facilities, defined by the * {@link java.util.ServiceLoader} class, to attempt to {@linkplain java.util.ServiceLoader#load(java.lang.Class, java.lang.ClassLoader) locate and load} an * implementation of the service using the specified {@code ClassLoader}. The similar change should be applied: to XMLInputFactory.newFactory(String factoryId, ClassLoader classLoader) and to XMLOutputFactory.newFactory(String factoryId, ClassLoader classLoader).
|