SecureXMLInputFactory (Apache Commons Secure XML 1.0.0 API)
Description: declaration: package: org.apache.commons.xml.secure, class: SecureXMLInputFactory

Package org.apache.commons.xml.secure

# Class SecureXMLInputFactory

java.lang.Object
org.apache.commons.xml.secure.SecureXMLInputFactory

public final class SecureXMLInputFactory extends Object
Creates new, secure `XMLInputFactory` instances.

The three universal guarantees on `org.apache.commons.xml.secure` apply; StAX exposes no additional vectors beyond them.

This class is not itself a `XMLInputFactory`, so it inherits none of the static JAXP factory methods. A caller therefore cannot obtain an unsecured factory through this class by calling a method such as `newDefaultFactory()`. The secure factories are instances of a nested, non-public wrapper class.

See Also:
  - `org.apache.commons.xml.secure`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static XMLInputFactory`
  `newDefaultFactory()`
  Returns a new, secure `XMLInputFactory` of the system-default implementation.
  `static XMLInputFactory`
  `newFactory()`
  Returns a new, secure `XMLInputFactory`, like `XMLInputFactory.newFactory()`.
  `static XMLInputFactory`
  `newFactory(String factoryId, ClassLoader classLoader)`
  Returns a new, secure `XMLInputFactory` resolved from the given factory id.
  `static XMLInputFactory`
  `newInstance()`
  Returns a new, secure `XMLInputFactory`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### newDefaultFactory

    public static XMLInputFactory newDefaultFactory()
    Returns a new, secure `XMLInputFactory` of the system-default implementation.

    Obtained from `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 neither `newDefaultFactory()` nor the JDK's built-in implementation (for example Android).

  - ### newFactory

    public static XMLInputFactory newFactory()
    Returns a new, secure `XMLInputFactory`, like `XMLInputFactory.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

    public static XMLInputFactory newFactory(String factoryId, ClassLoader classLoader)
    Returns a new, secure `XMLInputFactory` resolved 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; `null` means 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 if `factoryId` is `null`.

  - ### newInstance

    public static XMLInputFactory newInstance()
    Returns a new, secure `XMLInputFactory`.
    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.