# Schema

public abstract class **Schema** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
Immutable in-memory representation of grammar.


This object represents a set of constraints that can be checked/
enforced against an XML document.


A `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html` object is thread safe and applications are
encouraged to share it across many parsers in many threads.


A `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html` object is immutable in the sense that it shouldn't
change the set of constraints once it is created. In other words,
if an application validates the same document twice against the same
`https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html`, it must always produce the same result.


A `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html` object is usually created from `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html`.


Two kinds of validators can be created from a `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html` object.
One is `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Validator.html`, which provides highly-level validation
operations that cover typical use cases. The other is
`https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/ValidatorHandler.html`, which works on top of SAX for better
modularity.


This specification does not refine
the `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object)` method.
In other words, if you parse the same schema twice, you may
still get `!schemaA.equals(schemaB)`.

##### See Also

- [XML Schema Part 1: Structures](http://www.w3.org/TR/xmlschema-1/)
- [Extensible Markup Language (XML) 1.1](http://www.w3.org/TR/xml11/)
- [Extensible Markup Language (XML) 1.0 (Second Edition)](http://www.w3.org/TR/REC-xml)

### Protected Constructor Summary

|---|---|
|   | [Schema](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html#Schema())() Constructor for the derived class. |

### Public Method Summary

|---|---|
| abstract [Validator](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Validator.html) | [newValidator](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html#newValidator())() Creates a new `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Validator.html` for this `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html`. |
| abstract [ValidatorHandler](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/ValidatorHandler.html) | [newValidatorHandler](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html#newValidatorHandler())() Creates a new `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/ValidatorHandler.html` for this `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html`. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Protected Constructors

#### protected
**Schema**
()

Constructor for the derived class.


The constructor does nothing.

## Public Methods

#### public abstract [Validator](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Validator.html)
**newValidator**
()

Creates a new `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Validator.html` for this `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html`.


A validator enforces/checks the set of constraints this object
represents.

##### Returns

- Always return a non-null valid object.

#### public abstract [ValidatorHandler](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/ValidatorHandler.html)
**newValidatorHandler**
()

Creates a new `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/ValidatorHandler.html` for this `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html`.

##### Returns

- Always return a non-null valid object.