Class SecureXMLInputFactory
java.lang.Object
org.apache.commons.xml.secure.SecureXMLInputFactory
Creates new, secure
XMLInputFactory instances.
The three universal guarantees on org.apache.commons.xml.secure apply; StAX exposes no additional vectors beyond them.
Not a XMLInputFactory itself, so none of the JAXP static factory methods is inherited: a caller cannot reach a non-secured factory through this class
by calling an inherited method such as newDefaultFactory(). The secure factories are instances of a nested, non-public wrapper class.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic XMLInputFactoryReturns a new, secureXMLInputFactoryof the system-default implementation.static XMLInputFactoryReturns a new, secureXMLInputFactory, as byXMLInputFactory.newFactory().static XMLInputFactorynewFactory(String factoryId, ClassLoader classLoader) Returns a new, secureXMLInputFactoryresolved from the given factory id.static XMLInputFactoryReturns a new, secureXMLInputFactory.
-
Method Details
-
newDefaultFactory
Returns a new, secureXMLInputFactoryof the system-default implementation.Obtained as by
XMLInputFactory.newDefaultFactory()where the platform provides it (Java 9 or later), and by instantiating the JDK's built-in implementation directly on Java 8.- Returns:
- A secure factory.
- Throws:
IllegalStateException- Thrown if a required secure setting cannot be applied to the underlying implementation.FactoryConfigurationError- Thrown if the running platform provides neithernewDefaultFactory()nor the JDK's built-in implementation (for example Android).
-
newFactory
Returns a new, secureXMLInputFactory, as byXMLInputFactory.newFactory().- Returns:
- A secure factory.
- Throws:
IllegalStateException- Thrown if a required secure setting cannot be applied to the underlying implementation.FactoryConfigurationError- Thrown if an instance of this factory cannot be loaded.
-
newFactory
Returns a new, secureXMLInputFactoryresolved from the given factory id.- Parameters:
factoryId- The name of the factory to find; a system property or service id to look up, not the class name of the implementation.classLoader- The class loader used in the lookup;nullmeans the current thread's context class loader.- Returns:
- A secure factory.
- Throws:
IllegalStateException- Thrown if a required secure setting cannot be applied to the underlying implementation.FactoryConfigurationError- Thrown in case of a service configuration error or if the implementation is not available or cannot be instantiated.NullPointerException- Thrown iffactoryIdisnull.
-
newInstance
Returns a new, secureXMLInputFactory.- Returns:
- A secure factory.
- Throws:
IllegalStateException- Thrown if a required secure setting cannot be applied to the underlying implementation.FactoryConfigurationError- Thrown if an instance of this factory cannot be loaded.
-