Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Protected Ctors](https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#proctors) \| [Methods](https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#inhmethods)

# ValidatorHandler

` public abstract class ValidatorHandler `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/org/xml/sax/ContentHandler `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | javax.xml.validation.ValidatorHandler |

<br />

*** ** * ** ***

Streaming validator that works on SAX stream.

A `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` object is a thread-unsafe, non-reentrant object. In other words, it is the application's responsibility to make sure that one `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` object is not used from more than one thread at any given time.

`https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` checks if the SAX events follow the set of constraints described in the associated `https://developer.android.com/reference/javax/xml/validation/Schema`, and additionally it may modify the SAX events (for example by adding default values, etc.)

`https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` extends from `https://developer.android.com/reference/org/xml/sax/ContentHandler`, but it refines the underlying `https://developer.android.com/reference/org/xml/sax/ContentHandler` in the following way:

1. startElement/endElement events must receive non-null String for `uri`, `localName`, and `qname`, even though SAX allows some of them to be null. Similarly, the user-specified `https://developer.android.com/reference/org/xml/sax/ContentHandler` will receive non-null Strings for all three parameters.
2. Applications must ensure that `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler`'s `https://developer.android.com/reference/org/xml/sax/ContentHandler#startPrefixMapping(java.lang.String,%20java.lang.String)` and `https://developer.android.com/reference/org/xml/sax/ContentHandler#endPrefixMapping(java.lang.String)` are invoked properly. Similarly, the user-specified `https://developer.android.com/reference/org/xml/sax/ContentHandler` will receive startPrefixMapping/endPrefixMapping events. If the `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` introduces additional namespace bindings, the user-specified `https://developer.android.com/reference/org/xml/sax/ContentHandler` will receive additional startPrefixMapping/endPrefixMapping events.
3. `https://developer.android.com/reference/org/xml/sax/Attributes` for the `https://developer.android.com/reference/org/xml/sax/ContentHandler#startElement(java.lang.String,%20java.lang.String,%20java.lang.String,%20org.xml.sax.Attributes)` method may or may not include xmlns\* attributes.

A `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` is automatically reset every time the startDocument method is invoked.

## Recognized Properties and Features

This spec defines the following feature that must be recognized by all `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` implementations.

### `http://xml.org/sax/features/namespace-prefixes`

This feature controls how a `https://developer.android.com/reference/javax/xml/validation/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 `https://developer.android.com/reference/org/xml/sax/ContentHandler` will see the corresponding `xmlns*` attribute in the `https://developer.android.com/reference/org/xml/sax/Attributes` object of the `https://developer.android.com/reference/org/xml/sax/ContentHandler#startElement(java.lang.String,%20java.lang.String,%20java.lang.String,%20org.xml.sax.Attributes)` callback. Otherwise, `xmlns*` attributes must not be added to `https://developer.android.com/reference/org/xml/sax/Attributes` that's passed to the user-specified `https://developer.android.com/reference/org/xml/sax/ContentHandler`.

(Note that regardless of this switch, namespace bindings are always notified to applications through `https://developer.android.com/reference/org/xml/sax/ContentHandler#startPrefixMapping(java.lang.String,%20java.lang.String)` and `https://developer.android.com/reference/org/xml/sax/ContentHandler#endPrefixMapping(java.lang.String)` methods of the `https://developer.android.com/reference/org/xml/sax/ContentHandler` specified by the user.)

Note that this feature does *NOT* affect the way a `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` receives SAX events. It merely changes the way it augments SAX events.

This feature is set to `false` by default.

<br />

## Summary

| ### Protected constructors ||
|---|---|
| ` https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#ValidatorHandler()() ` Constructor for derived classes. |

| ### Public methods ||
|---|---|
| ` abstract https://developer.android.com/reference/org/xml/sax/ContentHandler` | ` https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#getContentHandler()() ` Gets the `https://developer.android.com/reference/org/xml/sax/ContentHandler` which receives the augmented validation result. |
| ` abstract https://developer.android.com/reference/org/xml/sax/ErrorHandler` | ` https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#getErrorHandler()() ` Gets the current `https://developer.android.com/reference/org/xml/sax/ErrorHandler` set to this `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler`. |
| ` boolean` | ` https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#getFeature(java.lang.String)(https://developer.android.com/reference/java/lang/String name) ` Look up the value of a feature flag. |
| ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#getProperty(java.lang.String)(https://developer.android.com/reference/java/lang/String name) ` Look up the value of a property. |
| ` abstract https://developer.android.com/reference/org/w3c/dom/ls/LSResourceResolver` | ` https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#getResourceResolver()() ` Gets the current `https://developer.android.com/reference/org/w3c/dom/ls/LSResourceResolver` set to this `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler`. |
| ` abstract https://developer.android.com/reference/javax/xml/validation/TypeInfoProvider` | ` https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#getTypeInfoProvider()() ` Obtains the `https://developer.android.com/reference/javax/xml/validation/TypeInfoProvider` implementation of this `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler`. |
| ` abstract void` | ` https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#setContentHandler(org.xml.sax.ContentHandler)(https://developer.android.com/reference/org/xml/sax/ContentHandler receiver) ` Sets the `https://developer.android.com/reference/org/xml/sax/ContentHandler` which receives the augmented validation result. |
| ` abstract void` | ` https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#setErrorHandler(org.xml.sax.ErrorHandler)(https://developer.android.com/reference/org/xml/sax/ErrorHandler errorHandler) ` Sets the `https://developer.android.com/reference/org/xml/sax/ErrorHandler` to receive errors encountered during the validation. |
| ` void` | ` https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#setFeature(java.lang.String,%20boolean)(https://developer.android.com/reference/java/lang/String name, boolean value) ` Set the value of a feature flag. |
| ` void` | ` https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#setProperty(java.lang.String,%20java.lang.Object)(https://developer.android.com/reference/java/lang/String name, https://developer.android.com/reference/java/lang/Object object) ` Set the value of a property. |
| ` abstract void` | ` https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#setResourceResolver(org.w3c.dom.ls.LSResourceResolver)(https://developer.android.com/reference/org/w3c/dom/ls/LSResourceResolver resourceResolver) ` Sets the `https://developer.android.com/reference/org/w3c/dom/ls/LSResourceResolver` to customize resource resolution while in a validation episode. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/org/xml/sax/ContentHandler ` ` abstract void` ` https://developer.android.com/reference/org/xml/sax/ContentHandler#characters(char[],%20int,%20int)(char[] ch, int start, int length) `

Receive notification of character data.
` abstract void` ` https://developer.android.com/reference/org/xml/sax/ContentHandler#endDocument()() `

Receive notification of the end of a document.
` abstract void` ` https://developer.android.com/reference/org/xml/sax/ContentHandler#endElement(java.lang.String,%20java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String uri, https://developer.android.com/reference/java/lang/String localName, https://developer.android.com/reference/java/lang/String qName) `

Receive notification of the end of an element.
` abstract void` ` https://developer.android.com/reference/org/xml/sax/ContentHandler#endPrefixMapping(java.lang.String)(https://developer.android.com/reference/java/lang/String prefix) `

End the scope of a prefix-URI mapping.
` abstract void` ` https://developer.android.com/reference/org/xml/sax/ContentHandler#ignorableWhitespace(char[],%20int,%20int)(char[] ch, int start, int length) `

Receive notification of ignorable whitespace in element content.
` abstract void` ` https://developer.android.com/reference/org/xml/sax/ContentHandler#processingInstruction(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String target, https://developer.android.com/reference/java/lang/String data) `

Receive notification of a processing instruction.
` abstract void` ` https://developer.android.com/reference/org/xml/sax/ContentHandler#setDocumentLocator(org.xml.sax.Locator)(https://developer.android.com/reference/org/xml/sax/Locator locator) `

Receive an object for locating the origin of SAX document events.
` abstract void` ` https://developer.android.com/reference/org/xml/sax/ContentHandler#skippedEntity(java.lang.String)(https://developer.android.com/reference/java/lang/String name) `

Receive notification of a skipped entity.
` abstract void` ` https://developer.android.com/reference/org/xml/sax/ContentHandler#startDocument()() `

Receive notification of the beginning of a document.
` abstract void` ` https://developer.android.com/reference/org/xml/sax/ContentHandler#startElement(java.lang.String,%20java.lang.String,%20java.lang.String,%20org.xml.sax.Attributes)(https://developer.android.com/reference/java/lang/String uri, https://developer.android.com/reference/java/lang/String localName, https://developer.android.com/reference/java/lang/String qName, https://developer.android.com/reference/org/xml/sax/Attributes atts) `

Receive notification of the beginning of an element.
` abstract void` ` https://developer.android.com/reference/org/xml/sax/ContentHandler#startPrefixMapping(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String prefix, https://developer.android.com/reference/java/lang/String uri) `

Begin the scope of a prefix-URI Namespace mapping.

## Protected constructors

### ValidatorHandler

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
protected ValidatorHandler ()
```

Constructor for derived classes.

The constructor does nothing.

Derived classes must create `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` objects that have null `https://developer.android.com/reference/org/xml/sax/ErrorHandler` and null `https://developer.android.com/reference/org/w3c/dom/ls/LSResourceResolver`.

<br />

## Public methods

### getContentHandler

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract ContentHandler getContentHandler ()
```

Gets the `https://developer.android.com/reference/org/xml/sax/ContentHandler` which receives the augmented validation result.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/org/xml/sax/ContentHandler` | This method returns the object that was last set through the `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#getContentHandler()` method, or null if that method has never been called since this `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` has created. <br /> |

**See also:**

- `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#setContentHandler(org.xml.sax.ContentHandler)`

### getErrorHandler

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract ErrorHandler getErrorHandler ()
```

Gets the current `https://developer.android.com/reference/org/xml/sax/ErrorHandler` set to this `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/org/xml/sax/ErrorHandler` | This method returns the object that was last set through the `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#setErrorHandler(org.xml.sax.ErrorHandler)` method, or null if that method has never been called since this `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` has created. <br /> |

**See also:**

- `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#setErrorHandler(org.xml.sax.ErrorHandler)`

### getFeature

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean getFeature (String name)
```

Look up the value of a feature flag.

The feature name is any fully-qualified URI. It is possible for a `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` to recognize a feature name but temporarily be unable to return its value. Some feature values may be available only in specific contexts, such as before, during, or after a validation.

Implementors are free (and encouraged) to invent their own features, using names built on their own URIs.

<br />

<br />

| Parameters ||
|---|---|
| `name` | `String`: The feature name, which is a non-null fully-qualified URI. <br /> |

| Returns ||
|---|---|
| `boolean` | The current value of the feature (true or false). <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | When the name parameter is null. |
| `https://developer.android.com/reference/org/xml/sax/SAXNotRecognizedException` | If the feature value can't be assigned or retrieved. |
| `https://developer.android.com/reference/org/xml/sax/SAXNotSupportedException` | When the `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` recognizes the feature name but cannot determine its value at this time. |

**See also:**

- `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#setFeature(java.lang.String,%20boolean)`

### getProperty

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Object getProperty (String name)
```

Look up the value of a property.

The property name is any fully-qualified URI. It is possible for a `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` to recognize a property name but temporarily be unable to return its value. Some property values may be available only in specific contexts, such as before, during, or after a validation.

`https://developer.android.com/reference/javax/xml/validation/ValidatorHandler`s are not required to recognize any specific property names.

Implementors are free (and encouraged) to invent their own properties, using names built on their own URIs.

<br />

<br />

| Parameters ||
|---|---|
| `name` | `String`: The property name, which is a non-null fully-qualified URI. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/Object` | The current value of the property. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | When the name parameter is null. |
| `https://developer.android.com/reference/org/xml/sax/SAXNotRecognizedException` | If the property value can't be assigned or retrieved. |
| `https://developer.android.com/reference/org/xml/sax/SAXNotSupportedException` | When the XMLReader recognizes the property name but cannot determine its value at this time. |

**See also:**

- `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#setProperty(java.lang.String,%20java.lang.Object)`

### getResourceResolver

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract LSResourceResolver getResourceResolver ()
```

Gets the current `https://developer.android.com/reference/org/w3c/dom/ls/LSResourceResolver` set to this `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/org/w3c/dom/ls/LSResourceResolver` | This method returns the object that was last set through the `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#setResourceResolver(org.w3c.dom.ls.LSResourceResolver)` method, or null if that method has never been called since this `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` has created. <br /> |

**See also:**

- `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#setErrorHandler(org.xml.sax.ErrorHandler)`

### getTypeInfoProvider

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract TypeInfoProvider getTypeInfoProvider ()
```

Obtains the `https://developer.android.com/reference/javax/xml/validation/TypeInfoProvider` implementation of this `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler`.

The obtained `https://developer.android.com/reference/javax/xml/validation/TypeInfoProvider` can be queried during a parse to access the type information determined by the validator.

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.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/javax/xml/validation/TypeInfoProvider` | null if the validator / schema language does not support the notion of `https://developer.android.com/reference/org/w3c/dom/TypeInfo`. Otherwise a non-null valid `https://developer.android.com/reference/javax/xml/validation/TypeInfoProvider`. <br /> |

### setContentHandler

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void setContentHandler (ContentHandler receiver)
```

Sets the `https://developer.android.com/reference/org/xml/sax/ContentHandler` which receives the augmented validation result.

When a `https://developer.android.com/reference/org/xml/sax/ContentHandler` is specified, a `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` will work as a filter and basically copy the incoming events to the specified `https://developer.android.com/reference/org/xml/sax/ContentHandler`.

In doing so, a `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` may modify the events, for example by adding defaulted attributes.

A `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` may buffer events to certain extent, but to allow `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` to be used by a parser, the following requirement has to be met.

1. When `https://developer.android.com/reference/org/xml/sax/ContentHandler#startElement(java.lang.String,%20java.lang.String,%20java.lang.String,%20org.xml.sax.Attributes)`, `https://developer.android.com/reference/org/xml/sax/ContentHandler#endElement(java.lang.String,%20java.lang.String,%20java.lang.String)`, `https://developer.android.com/reference/org/xml/sax/ContentHandler#startDocument()`, or `https://developer.android.com/reference/org/xml/sax/ContentHandler#endDocument()` are invoked on a `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler`, the same method on the user-specified `https://developer.android.com/reference/org/xml/sax/ContentHandler` must be invoked for the same event before the callback returns.
2. `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` may not introduce new elements that were not present in the input.
3. `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` may not remove attributes that were present in the input.

When a callback method on the specified `https://developer.android.com/reference/org/xml/sax/ContentHandler` throws an exception, the same exception object must be thrown from the `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler`. The `https://developer.android.com/reference/org/xml/sax/ErrorHandler` should not be notified of such an exception.

This method can be called even during a middle of a validation.

<br />

| Parameters ||
|---|---|
| `receiver` | `ContentHandler`: A `https://developer.android.com/reference/org/xml/sax/ContentHandler` or a null value. <br /> |

### setErrorHandler

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void setErrorHandler (ErrorHandler errorHandler)
```

Sets the `https://developer.android.com/reference/org/xml/sax/ErrorHandler` to receive errors encountered during the validation.

Error handler can be used to customize the error handling process during a validation. When an `https://developer.android.com/reference/org/xml/sax/ErrorHandler` is set, errors found during the validation will be first sent to the `https://developer.android.com/reference/org/xml/sax/ErrorHandler`.

The error handler can abort further validation immediately by throwing `https://developer.android.com/reference/org/xml/sax/SAXException` from the handler. Or for example it can print an error to the screen and try to continue the validation by returning normally from the `https://developer.android.com/reference/org/xml/sax/ErrorHandler`

If any `https://developer.android.com/reference/java/lang/Throwable` is thrown from an `https://developer.android.com/reference/org/xml/sax/ErrorHandler`, the same `https://developer.android.com/reference/java/lang/Throwable` object will be thrown toward the root of the call stack.

`https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` is not allowed to throw `https://developer.android.com/reference/org/xml/sax/SAXException` without first reporting it to `https://developer.android.com/reference/org/xml/sax/ErrorHandler`.

When the `https://developer.android.com/reference/org/xml/sax/ErrorHandler` is null, the implementation will behave as if the following `https://developer.android.com/reference/org/xml/sax/ErrorHandler` is set:

    class DraconianErrorHandler implements https://developer.android.com/reference/org/xml/sax/ErrorHandler {
        public void fatalError( https://developer.android.com/reference/org/xml/sax/SAXParseException e ) throws https://developer.android.com/reference/org/xml/sax/SAXException {
            throw e;
        }
        public void error( https://developer.android.com/reference/org/xml/sax/SAXParseException e ) throws https://developer.android.com/reference/org/xml/sax/SAXException {
            throw e;
        }
        public void warning( https://developer.android.com/reference/org/xml/sax/SAXParseException e ) throws https://developer.android.com/reference/org/xml/sax/SAXException {
            // noop
        }
    }

When a new `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` object is created, initially this field is set to null.

<br />

| Parameters ||
|---|---|
| `errorHandler` | `ErrorHandler`: A new error handler to be set. This parameter can be null. <br /> |

### setFeature

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setFeature (String name, 
                boolean value)
```

Set the value of a feature flag.

Feature can be used to control the way a `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` parses schemas, although `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler`s are not required to recognize any specific property names.

The feature name is any fully-qualified URI. It is possible for a `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` to expose a feature value but to be unable to change the current value. Some feature values may be immutable or mutable only in specific contexts, such as before, during, or after a validation.

<br />

<br />

| Parameters ||
|---|---|
| `name` | `String`: The feature name, which is a non-null fully-qualified URI. <br /> |
| `value` | `boolean`: The requested value of the feature (true or false). <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | When the name parameter is null. |
| `https://developer.android.com/reference/org/xml/sax/SAXNotRecognizedException` | If the feature value can't be assigned or retrieved. |
| `https://developer.android.com/reference/org/xml/sax/SAXNotSupportedException` | When the `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` recognizes the feature name but cannot set the requested value. |

**See also:**

- `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler#getFeature(java.lang.String)`

### setProperty

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setProperty (String name, 
                Object object)
```

Set the value of a property.

The property name is any fully-qualified URI. It is possible for a `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` to recognize a property name but to be unable to change the current value. Some property values may be immutable or mutable only in specific contexts, such as before, during, or after a validation.

`https://developer.android.com/reference/javax/xml/validation/ValidatorHandler`s are not required to recognize setting any specific property names.

<br />

<br />

| Parameters ||
|---|---|
| `name` | `String`: The property name, which is a non-null fully-qualified URI. <br /> |
| `object` | `Object`: The requested value for the property. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | When the name parameter is null. |
| `https://developer.android.com/reference/org/xml/sax/SAXNotRecognizedException` | If the property value can't be assigned or retrieved. |
| `https://developer.android.com/reference/org/xml/sax/SAXNotSupportedException` | When the `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` recognizes the property name but cannot set the requested value. |

### setResourceResolver

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void setResourceResolver (LSResourceResolver resourceResolver)
```

Sets the `https://developer.android.com/reference/org/w3c/dom/ls/LSResourceResolver` to customize resource resolution while in a validation episode.

`https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` uses a `https://developer.android.com/reference/org/w3c/dom/ls/LSResourceResolver` when it needs to locate external resources while a validation, although exactly what constitutes "locating external resources" is up to each schema language.

When the `https://developer.android.com/reference/org/w3c/dom/ls/LSResourceResolver` is null, the implementation will behave as if the following `https://developer.android.com/reference/org/w3c/dom/ls/LSResourceResolver` is set:

    class DumbLSResourceResolver implements https://developer.android.com/reference/org/w3c/dom/ls/LSResourceResolver {
        public https://developer.android.com/reference/org/w3c/dom/ls/LSInput resolveResource(
            String publicId, String systemId, String baseURI) {

            return null; // always return null
        }
    }

If a `https://developer.android.com/reference/org/w3c/dom/ls/LSResourceResolver` throws a `https://developer.android.com/reference/java/lang/RuntimeException` (or instances of its derived classes), then the `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` will abort the parsing and the caller of the `validate` method will receive the same `https://developer.android.com/reference/java/lang/RuntimeException`.

When a new `https://developer.android.com/reference/javax/xml/validation/ValidatorHandler` object is created, initially this field is set to null.

<br />

| Parameters ||
|---|---|
| `resourceResolver` | `LSResourceResolver`: A new resource resolver to be set. This parameter can be null. <br /> |