A ValidatorHandler object is not thread-safe and not reentrant.
In other words, it is the application's responsibility to make
sure that one ValidatorHandler object is not used from
more than one thread at any given time.
ValidatorHandler checks if the SAX events follow
the set of constraints described in the associated Schema,
and additionally it may modify the SAX events (for example
by adding default values, etc.)
ValidatorHandler extends from ContentHandler,
but it refines the underlying ContentHandler in
the following way:
uri, localName, and qname,
even though SAX allows some of them to be null.
Similarly, the user-specified ContentHandler will receive non-null
Strings for all three parameters.
ValidatorHandler's
ContentHandler#startPrefixMapping(String, String) and
ContentHandler#endPrefixMapping(String) are invoked
properly. Similarly, the user-specified ContentHandler
will receive startPrefixMapping/endPrefixMapping events.
If the ValidatorHandler introduces additional namespace
bindings, the user-specified ContentHandler will receive
additional startPrefixMapping/endPrefixMapping events.
org.xml.sax.Attributes for the
ContentHandler#startElement(String, String, String, Attributes) method
may or may not include xmlns* attributes.
A ValidatorHandler is automatically reset every time
the startDocument method is invoked.
This spec defines the following feature that must be recognized
by all ValidatorHandler implementations.
http://xml.org/sax/features/namespace-prefixes
This feature controls how a ValidatorHandler introduces
namespace bindings that were not present in the original SAX event
stream.
When this feature is set to true, it must make
sure that the user's ContentHandler will see
the corresponding xmlns* attribute in
the org. object of the
ContentHandler#startElement(String, String, String, Attributes)
callback. Otherwise, xmlns* attributes must not be
added to org. that's passed to the
user-specified ContentHandler.
(Note that regardless of this switch, namespace bindings are
always notified to applications through
ContentHandler#startPrefixMapping(String, String) and
ContentHandler#endPrefixMapping(String) methods of the
ContentHandler specified by the user.)
Note that this feature does NOT affect the way
a ValidatorHandler receives SAX events. It merely
changes the way it augments SAX events.
This feature is set to false by default.
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public abstract ContentHandler | Returns: This method returns the object that was last set through thegetContentHandler() method, or null
if that method has never been called since this ValidatorHandler
has created.Gets the |
| 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 ValidatorHandler
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 ValidatorHandler
has created.Gets the current |
| public abstract TypeInfoProvider | Returns: null if the validator / schema language does not support the notion oforg..
Otherwise a non-null valid TypeInfoProvider.Obtains the |
| public abstract void | setContentHandler(ContentHandler
A receiver)ContentHandler or a null value.Sets the |
| public abstract void | setErrorHandler(ErrorHandler
A new error handler to be set. This parameter can be null. errorHandler)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 |
| ValidatorHandler | back to summary |
|---|---|
| protected ValidatorHandler() Constructor for derived classes. The constructor does nothing. Derived classes must create | |
| getContentHandler | back to summary |
|---|---|
| public abstract ContentHandler getContentHandler() Gets the
| |
| 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
| |
| getTypeInfoProvider | back to summary |
|---|---|
| public abstract TypeInfoProvider getTypeInfoProvider() Obtains the
The obtained Some schema languages do not define the notion of type, for those languages, this method may not be supported. However, to be compliant with this specification, implementations for W3C XML Schema 1.0 must support this operation.
| |
| setContentHandler | back to summary |
|---|---|
| public abstract void setContentHandler(ContentHandler receiver) Sets the
When a
In doing so, a
A
When a callback method on the specified This method can be called even during a middle of a validation.
| |
| setErrorHandler | back to summary |
|---|---|
| public abstract void setErrorHandler(ErrorHandler errorHandler) Sets the
Error handler can be used to customize the error handling process
during a validation. When an
The error handler can abort further validation immediately
by throwing
If any
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 Feature can be used to control the way 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
| |
| setResourceResolver | back to summary |
|---|---|
| public abstract void setResourceResolver(LSResourceResolver resourceResolver) Sets the
When the class DumbLSResourceResolver implements
If a
When a new
| |