Package org.codehaus.stax2.validation
Class XMLValidationSchemaFactory
java.lang.Object
org.codehaus.stax2.validation.XMLValidationSchemaFactory
Defines an abstract factory for constructing
XMLValidationSchema
instances. This abstract base class has methods for instantiating the
actual implementation (similar to the way
XMLInputFactory
works, and defines the API to
use for configuring these instances, as well as factory methods concrete
classes implement for actually creating XMLValidationSchema
instances.
Note: this class is part of the second major revision of StAX 2 API (StAX2, v2), and is optional for StAX2 implementations to support.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
(package private) static final String
Name of resource file that contains JAXP properties.protected final String
Schema type this factory instance supports.static final String
Property that determines whether schema instances created by this factory instance can be cached by the factory; if false, no caching is allowed to be doe; if true, factory can do caching if it wants to.static final String
Property that determines whether schemas constructed are namespace-aware, in cases where schema supports both namespace-aware and non-namespace aware modes.static final String
Path to resource that should contain implementation class definition.static final String
Defines the system property that can be set to explicitly specify which implementation to use (in case there are multiple StAX2 implementations; or the one used does not specify other mechanisms for the loader to find the implementation class). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static XMLValidationSchemaFactory
createNewInstance
(ClassLoader cloader, String clsName) abstract XMLValidationSchema
createSchema
(File f) createSchema
(InputStream in, String encoding) abstract XMLValidationSchema
createSchema
(InputStream in, String encoding, String publicId, String systemId) abstract XMLValidationSchema
createSchema
(Reader r, String publicId, String systemId) abstract XMLValidationSchema
createSchema
(URL url) abstract Object
getProperty
(String propName) final String
abstract boolean
isPropertySupported
(String propName) static XMLValidationSchemaFactory
newInstance
(String schemaType) Creates a new XMLValidationFactory instance, using the default instance configuration mechanism.static XMLValidationSchemaFactory
newInstance
(String schemaType, ClassLoader classLoader) abstract boolean
setProperty
(String propName, Object value)
-
Field Details
-
INTERNAL_ID_SCHEMA_DTD
- See Also:
-
INTERNAL_ID_SCHEMA_RELAXNG
- See Also:
-
INTERNAL_ID_SCHEMA_W3C
- See Also:
-
INTERNAL_ID_SCHEMA_TREX
- See Also:
-
sSchemaIds
-
JAXP_PROP_FILENAME
Name of resource file that contains JAXP properties.- See Also:
-
SYSTEM_PROPERTY_FOR_IMPL
Defines the system property that can be set to explicitly specify which implementation to use (in case there are multiple StAX2 implementations; or the one used does not specify other mechanisms for the loader to find the implementation class).- See Also:
-
SERVICE_DEFINITION_PATH
Path to resource that should contain implementation class definition.- See Also:
-
P_IS_NAMESPACE_AWARE
Property that determines whether schemas constructed are namespace-aware, in cases where schema supports both namespace-aware and non-namespace aware modes. In general this only applies to DTDs, since namespace support for DTDs is both optional, and not well specified.Default value is TRUE. For schema types for which only one value (usually TRUE) is allowed, this property will be ignored.
- See Also:
-
P_ENABLE_CACHING
Property that determines whether schema instances created by this factory instance can be cached by the factory; if false, no caching is allowed to be doe; if true, factory can do caching if it wants to. The exact rules used to determine unique id of schema instances is factory dependant; it is expected that the implementations use implementation based on unified system ids (serialized URLs or such).- See Also:
-
mSchemaType
Schema type this factory instance supports.
-
-
Constructor Details
-
XMLValidationSchemaFactory
- Parameters:
st
- Schema type this factory supports; one ofSCHEMA_ID_xxx
constants.
-
-
Method Details
-
newInstance
public static XMLValidationSchemaFactory newInstance(String schemaType) throws FactoryConfigurationError Creates a new XMLValidationFactory instance, using the default instance configuration mechanism.- Throws:
FactoryConfigurationError
-
newInstance
public static XMLValidationSchemaFactory newInstance(String schemaType, ClassLoader classLoader) throws FactoryConfigurationError - Throws:
FactoryConfigurationError
-
createSchema
- Throws:
XMLStreamException
-
createSchema
- Throws:
XMLStreamException
-
createSchema
public abstract XMLValidationSchema createSchema(InputStream in, String encoding, String publicId, String systemId) throws XMLStreamException - Throws:
XMLStreamException
-
createSchema
- Throws:
XMLStreamException
-
createSchema
public abstract XMLValidationSchema createSchema(Reader r, String publicId, String systemId) throws XMLStreamException - Throws:
XMLStreamException
-
createSchema
- Throws:
XMLStreamException
-
createSchema
- Throws:
XMLStreamException
-
isPropertySupported
-
setProperty
- Parameters:
propName
- Name of property to setvalue
- Value to set property to- Returns:
- True if setting succeeded; false if property was recognized but could not be changed to specified value, or if it was not recognized but the implementation did not throw an exception.
-
getProperty
-
getSchemaType
- Returns:
- Name of schema type (one of
SCHEMA_ID_xxx
constants) that this factory supports.
-
createNewInstance
private static XMLValidationSchemaFactory createNewInstance(ClassLoader cloader, String clsName) throws FactoryConfigurationError - Throws:
FactoryConfigurationError
-