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 Stringstatic final Stringstatic final Stringstatic final Stringprotected final StringSchema type this factory instance supports.static final StringProperty 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 StringProperty that determines whether schemas constructed are namespace-aware, in cases where schema supports both namespace-aware and non-namespace aware modes.static final StringPath to resource that should contain implementation class definition.static final StringDefines 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 TypeMethodDescriptionabstract XMLValidationSchemacreateSchema(File f) createSchema(InputStream in, String encoding) abstract XMLValidationSchemacreateSchema(InputStream in, String encoding, String publicId, String systemId) abstract XMLValidationSchemacreateSchema(Reader r, String publicId, String systemId) abstract XMLValidationSchemacreateSchema(URL url) abstract ObjectgetProperty(String propName) final Stringabstract booleanisPropertySupported(String propName) static XMLValidationSchemaFactorynewInstance(String schemaType) Creates a new XMLValidationFactory instance, using the default instance configuration mechanism.static XMLValidationSchemaFactorynewInstance(String schemaType, ClassLoader classLoader) abstract booleansetProperty(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:
-
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_xxxconstants.
-
-
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_xxxconstants) that this factory supports.
-