Schema objects. Entry-point to
the validation API.
SchemaFactory is a schema compiler. It reads external
representations of schemas and prepares them for validation.
The SchemaFactory class is not thread-safe. In other words,
it is the application's responsibility to ensure that at most
one thread is using a SchemaFactory object at any
given moment. Implementations are encouraged to mark methods
as synchronized to protect themselves from broken clients.
SchemaFactory is not re-entrant. While one of the
newSchema methods is being invoked, applications
may not attempt to recursively invoke the newSchema method,
even from the same thread.
This spec uses a namespace URI to designate a schema language. The following table shows the values defined by this specification.
To be compliant with the spec, the implementation is only required to support W3C XML Schema 1.0. However, if it chooses to support other schema languages listed here, it must conform to the relevant behaviors described in this spec.
Schema languages not listed here are expected to
introduce their own URIs to represent themselves.
The SchemaFactory class is capable of locating other
implementations for other schema languages at run-time.
Note that because the XML DTD is strongly tied to the parsing process and has a significant effect on the parsing process, it is impossible to define the DTD validation as a process independent from parsing. For this reason, this specification does not define the semantics for the XML DTD. This doesn't prohibit implementors from implementing it in a way they see fit, but users are warned that any DTD validation implemented on this interface necessarily deviate from the XML DTD semantics as defined in the XML 1.0.
| value | language |
|---|---|
javax. ("http://www.w3.org/2001/XMLSchema") |
W3C XML Schema 1.0 |
javax. ("http://relaxng.org/ns/structure/1.0") |
RELAX NG 1.0 |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public abstract ErrorHandler | Returns: This method returns the object that was last set through thesetErrorHandler(ErrorHandler) method, or null
if that method has never been called since this SchemaFactory
has created.Gets the current |
| public boolean | Returns: The current value of the feature (true or false).The feature name, which is a non-null fully-qualified URI. name)Look up the value of a feature flag. |
| public Object | Returns: The current value of the property.The property name, which is a non-null fully-qualified URI. name)Look up the value of a property. |
| public abstract LSResourceResolver | Returns: This method returns the object that was last set through thesetResourceResolver(LSResourceResolver) method, or null
if that method has never been called since this SchemaFactory
has created.Gets the current |
| public abstract boolean | Returns: true if SchemaFactory supports schemaLanguage, else false.Specifies the schema language which the returned schemaLanguage)SchemaFactory will understand.
schemaLanguage must specify a valid schema language.Is specified schema supported by this |
| public static SchemaFactory | Returns: A new instance of theSchemaFactory builtin
system-default implementation.Creates a new instance of the |
| public static SchemaFactory | Returns: New instance of aSchemaFactorySpecifies the schema language which the returned
SchemaFactory will understand. See
the list of available
schema languages for the possible values. schemaLanguage)Obtains a new instance of a |
| public static SchemaFactory | Returns: New instance of aSchemaFactorySpecifies the schema language which the returned
schemaLanguage, String SchemaFactory will understand. See
the list of available
schema languages for the possible values.fully qualified factory class name that provides implementation of factoryClassName, ClassLoader javax.xml.validation.SchemaFactory.ClassLoader used to load the factory class. If null
current Thread's context classLoader is used to load the factory class.Obtain a new instance of a |
| public Schema | |
| public Schema | |
| public Schema | |
| public abstract Schema | newSchema(Source[]
inputs to be parsed. schemas)SchemaFactory is required
to recognize javax.,
StreamSource,
javax.,
and javax..
Input schemas must be XML documents or
XML elements and must not be null. For backwards compatibility,
the results of passing anything other than
a document or element are implementation-dependent.
Implementations must either recognize and process the input
or thrown an IllegalArgumentException.Parses the specified source(s) as a schema and returns it as a schema. |
| public abstract Schema | |
| public abstract void | setErrorHandler(ErrorHandler
A new error handler to be set.
This parameter can be errorHandler)null.Sets the |
| public void | setFeature(String
The feature name, which is a non-null fully-qualified URI. name, boolean The requested value of the feature (true or false). value)Set a feature for this |
| public void | setProperty(String
The property name, which is a non-null fully-qualified URI. name, Object The requested value for the property. object)Set the value of a property. |
| public abstract void | setResourceResolver(LSResourceResolver
A new resource resolver to be set. This parameter can be null. resourceResolver)Sets the |
| SchemaFactory | back to summary |
|---|---|
| protected SchemaFactory() Constructor for derived classes. The constructor does nothing. Derived classes must create | |
| getErrorHandler | back to summary |
|---|---|
| public abstract ErrorHandler getErrorHandler() Gets the current
| |
| getFeature | back to summary |
|---|---|
| public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException Look up the value of a feature flag. The feature name is any fully-qualified URI. It is
possible for a Implementors are free (and encouraged) to invent their own features, using names built on their own URIs.
| |
| getProperty | back to summary |
|---|---|
| public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException Look up the value of a property. The property name is any fully-qualified URI. It is
possible for a
Implementors are free (and encouraged) to invent their own properties, using names built on their own URIs.
| |
| getResourceResolver | back to summary |
|---|---|
| public abstract LSResourceResolver getResourceResolver() Gets the current
| |
| isSchemaLanguageSupported | back to summary |
|---|---|
| public abstract boolean isSchemaLanguageSupported(String schemaLanguage) Is specified schema supported by this
| |
| newDefaultInstance | back to summary |
|---|---|
| public static SchemaFactory newDefaultInstance() Creates a new instance of the Implementation Specification The
| |
| newInstance | back to summary |
|---|---|
| public static SchemaFactory newInstance(String schemaLanguage) Obtains a new instance of a Tip for Trouble-shooting:See http\://www.w3.org/2001/XMLSchema=org.acme.foo.XSSchemaFactory
| |
| newInstance | back to summary |
|---|---|
| public static SchemaFactory newInstance(String schemaLanguage, String factoryClassName, ClassLoader classLoader) Obtain a new instance of a Tip for Trouble-shootingSetting the If you have problems try: java -Djaxp.debug=1 YourProgram ....
| |
| newSchema | back to summary |
|---|---|
| public Schema newSchema(Source schema) throws SAXException Parses the specified source as a schema and returns it as a schema. This is a convenience method for
| |
| newSchema | back to summary |
|---|---|
| public Schema newSchema(File schema) throws SAXException Parses the specified This is a convenience method for
| |
| newSchema | back to summary |
|---|---|
| public Schema newSchema(URL schema) throws SAXException Parses the specified This is a convenience method for
| |
| newSchema | back to summary |
|---|---|
| public abstract Schema newSchema(Source[] schemas) throws SAXException Parses the specified source(s) as a schema and returns it as a schema.
The callee will read all the
When an W3C XML Schema 1.0
The resulting schema contains components from the specified sources.
The same result would be achieved if all these sources were
imported, using appropriate values for schemaLocation and namespace,
into a single schema document with a different targetNamespace
and no components of its own, if the import elements were given
in the same order as the sources. Section 4.2.3 of the XML Schema
recommendation describes the options processors have in this
regard. While a processor should be consistent in its treatment of
JAXP schema sources and XML Schema imports, the behaviour between
JAXP-compliant parsers may vary; in particular, parsers may choose
to ignore all but the first
If the parsed set of schemas includes error(s) as
specified in the section 5.1 of the XML Schema spec, then
the error must be reported to the RELAX NGFor RELAX NG, this method must throw
| |
| newSchema | back to summary |
|---|---|
| public abstract Schema newSchema() throws SAXException Creates a special The exact semantics of the returned Also, implementations are allowed to use implementation-specific property/feature to alter the semantics of this method. Implementors and developers should pay particular attention
to how the features set on this W3C XML Schema 1.0
For XML Schema, this method creates a
The returned Note that the use of schema location hints introduces a vulnerability to denial-of-service attacks. RELAX NGRELAX NG does not support this operation.
| |
| setErrorHandler | back to summary |
|---|---|
| public abstract void setErrorHandler(ErrorHandler errorHandler) Sets the
Error handler can be used to customize the error handling process
during schema parsing. When an
The error handler can abort the parsing of a schema immediately
by throwing
If any
Applications can call this method even during a
When the class DraconianErrorHandler implements
When a new
| |
| setFeature | back to summary |
|---|---|
| public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException Set a feature for this Implementors and developers should pay particular attention
to how the special The feature name is any fully-qualified URI. It is
possible for a All implementations are required to support the
| |
| setProperty | back to summary |
|---|---|
| public void setProperty(String name, Object object) throws SAXNotRecognizedException, SAXNotSupportedException Set the value of a property. The property name is any fully-qualified URI. It is
possible for a
All implementations that implement JAXP 1.5 or newer are required to
support the
| |
| setResourceResolver | back to summary |
|---|---|
| public abstract void setResourceResolver(LSResourceResolver resourceResolver) Sets the
Applications can call this method even during a
When the class DumbDOMResourceResolver implements
If a
When a new
| |