Class SecureSchemaFactory
SchemaFactory instances.
Beyond the three universal guarantees on org.apache.commons.xml.secure:
xs:import,xs:includeandxs:redefineschemaLocation URIs are not resolved during schema compilation, andxsi:schemaLocation/xsi:noNamespaceSchemaLocationhints in instance documents are not resolved during validation.
The same guarantees apply to Validator and ValidatorHandler instances produced from the
resulting Schema.
Not a SchemaFactory 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 newDefaultInstance(). The secure factories are instances of a nested, non-public wrapper class.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic SchemaFactoryReturns a new, secureSchemaFactoryof the system-default implementation, supporting W3C XML Schema 1.0.static SchemaFactorynewInstance(String schemaLanguage) Returns a new, secureSchemaFactoryfor the given schema language.static SchemaFactorynewInstance(String schemaLanguage, String factoryClassName, ClassLoader classLoader) Returns a new, secureSchemaFactoryof the given implementation class.
-
Method Details
-
newDefaultInstance
Returns a new, secureSchemaFactoryof the system-default implementation, supporting W3C XML Schema 1.0.Obtained as by
SchemaFactory.newDefaultInstance()where the platform provides it (Java 9 or later), by instantiating the JDK's built-in implementation directly on Java 8, and by the standardnewInstance(String)lookup where the platform provides neither (for example Android, whose lookup falls back to exactly the Xerces implementation this library recognizes).- Returns:
- A secure factory.
- Throws:
IllegalStateException- Thrown if a required secure setting cannot be applied to the underlying implementation.IllegalArgumentException- Thrown from thenewInstance(String)lookup this method falls back to on a platform that provides neithernewDefaultInstance()nor the JDK's built-in implementation (for example Android).
-
newInstance
Returns a new, secureSchemaFactoryfor the given schema language.- Parameters:
schemaLanguage- The schema language, as accepted bySchemaFactory.newInstance(String).- Returns:
- A secure factory.
- Throws:
IllegalArgumentException- Thrown if no implementation of the schema language is available.NullPointerException- Thrown ifschemaLanguageisnull.SchemaFactoryConfigurationError- Thrown if a configuration error is encountered.
-
newInstance
public static SchemaFactory newInstance(String schemaLanguage, String factoryClassName, ClassLoader classLoader) Returns a new, secureSchemaFactoryof the given implementation class.- Parameters:
schemaLanguage- The schema language, as accepted bySchemaFactory.newInstance(String).factoryClassName- The fully qualified class name of theSchemaFactoryimplementation.classLoader- The class loader used to load the factory class;nullmeans the current thread's context class loader.- Returns:
- A secure factory.
- Throws:
IllegalArgumentException- Thrown iffactoryClassNameisnull, or if the factory class cannot be loaded or instantiated, or does not supportschemaLanguage.NullPointerException- Thrown ifschemaLanguageisnull.
-