# SchemaFactory

public abstract class **SchemaFactory** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
Factory that creates `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html` objects. Entry-point to
the validation API.


`https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` is a schema compiler. It reads external
representations of schemas and prepares them for validation.


The `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` class is not thread-safe. In other words,
it is the application's responsibility to ensure that at most
one thread is using a `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` object at any
given moment. Implementations are encouraged to mark methods
as synchronized to protect themselves from broken clients.


`https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` 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.

## Schema Language


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 `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` 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 implementers 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 |
|---|---|
| `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/XMLConstants.html#W3C_XML_SCHEMA_NS_URI` ("`http://www.w3.org/2001/XMLSchema`") | [W3C XML Schema 1.0](http://www.w3.org/TR/xmlschema-1) |
| `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/XMLConstants.html#RELAXNG_NS_URI` ("`http://relaxng.org/ns/structure/1.0`") | [RELAX NG 1.0](http://www.relaxng.org/) |

<br />

### Protected Constructor Summary

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

### Public Method Summary

|---|---|
| abstract [ErrorHandler](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html) | [getErrorHandler](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#getErrorHandler())() Gets the current `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html` set to this `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html`. |
| boolean | [getFeature](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#getFeature(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name) Look up the value of a feature flag. |
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [getProperty](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#getProperty(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name) Look up the value of a property. |
| abstract [LSResourceResolver](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/ls/LSResourceResolver.html) | [getResourceResolver](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#getResourceResolver())() Gets the current `https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/ls/LSResourceResolver.html` set to this `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html`. |
| abstract boolean | [isSchemaLanguageSupported](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#isSchemaLanguageSupported(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) schemaLanguage) Is specified schema supported by this `SchemaFactory`? |
| static [SchemaFactory](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html) | [newInstance](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#newInstance(java.lang.String,%20java.lang.String,%20java.lang.ClassLoader))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) schemaLanguage, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) factoryClassName, [ClassLoader](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/ClassLoader.html) classLoader) Returns an instance of the named implementation of `SchemaFactory`. |
| static [SchemaFactory](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html) | [newInstance](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#newInstance(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) schemaLanguage) Lookup an implementation of the `SchemaFactory` that supports the specified schema language and return it. |
| [Schema](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html) | [newSchema](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#newSchema(java.io.File))([File](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/File.html) schema) Parses the specified `File` as a schema and returns it as a `Schema`. |
| [Schema](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html) | [newSchema](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#newSchema(javax.xml.transform.Source))([Source](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/Source.html) schema) Parses the specified source as a schema and returns it as a schema. |
| abstract [Schema](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html) | [newSchema](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#newSchema())() Creates a special `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html` object. |
| abstract [Schema](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html) | [newSchema](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#newSchema(javax.xml.transform.Source[]))([Source\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/Source.html) schemas) Parses the specified source(s) as a schema and returns it as a schema. |
| [Schema](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html) | [newSchema](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#newSchema(java.net.URL))([URL](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/URL.html) schema) Parses the specified `URL` as a schema and returns it as a `Schema`. |
| abstract void | [setErrorHandler](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#setErrorHandler(org.xml.sax.ErrorHandler))([ErrorHandler](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html) errorHandler) Sets the `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html` to receive errors encountered during the `newSchema` method invocation. |
| void | [setFeature](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#setFeature(java.lang.String,%20boolean))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name, boolean value) Set the value of a feature flag. |
| void | [setProperty](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#setProperty(java.lang.String,%20java.lang.Object))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name, [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) object) Set the value of a property. |
| abstract void | [setResourceResolver](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#setResourceResolver(org.w3c.dom.ls.LSResourceResolver))([LSResourceResolver](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/ls/LSResourceResolver.html) resourceResolver) Sets the `https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/ls/LSResourceResolver.html` to customize resource resolution when parsing schemas. |

### 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
**SchemaFactory**
()

<br />

Constructor for derived classes.

The constructor does nothing.

Derived classes must create `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` objects that have
`null` `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html` and
`null` `https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/ls/LSResourceResolver.html`.

<br />

## Public Methods

#### public abstract [ErrorHandler](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html)
**getErrorHandler**
()

Gets the current `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html` set to this `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html`.

##### Returns

- This method returns the object that was last set through the `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#setErrorHandler(org.xml.sax.ErrorHandler)` method, or null if that method has never been called since this `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` has created.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#setErrorHandler(org.xml.sax.ErrorHandler)`

#### public boolean
**getFeature**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name)

Look up the value of a feature flag.

The feature name is any fully-qualified URI. It is
possible for a `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` to recognize a feature name but
temporarily be unable to return its value.

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

<br />

##### Parameters

| name | The feature name, which is a non-null fully-qualified URI. |
|---|---|

##### Returns

- The current value of the feature (true or false).

##### Throws

| [SAXNotRecognizedException](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXNotRecognizedException.html) | If the feature value can't be assigned or retrieved. |
| [SAXNotSupportedException](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXNotSupportedException.html) | When the `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` recognizes the feature name but cannot determine its value at this time. |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if the name parameter is null. |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#setFeature(java.lang.String,%20boolean)`

#### public [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)
**getProperty**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name)

Look up the value of a property.

The property name is any fully-qualified URI. It is
possible for a `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` to recognize a property name but
temporarily be unable to return its value.

`https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html`s are not required to recognize any specific
property names.

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

<br />

##### Parameters

| name | The property name, which is a non-null fully-qualified URI. |
|---|---|

##### Returns

- The current value of the property.

##### Throws

| [SAXNotRecognizedException](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXNotRecognizedException.html) | If the property value can't be assigned or retrieved. |
| [SAXNotSupportedException](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXNotSupportedException.html) | When the XMLReader recognizes the property name but cannot determine its value at this time. |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if the name parameter is null. |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#setProperty(java.lang.String,%20java.lang.Object)`

#### public abstract [LSResourceResolver](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/ls/LSResourceResolver.html)
**getResourceResolver**
()

Gets the current `https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/ls/LSResourceResolver.html` set to this `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html`.

##### Returns

- This method returns the object that was last set through the `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#setResourceResolver(org.w3c.dom.ls.LSResourceResolver)` method, or null if that method has never been called since this `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` has created.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#setErrorHandler(org.xml.sax.ErrorHandler)`

#### public abstract boolean
**isSchemaLanguageSupported**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) schemaLanguage)

<br />

Is specified schema supported by this `SchemaFactory`?

<br />

##### Parameters

| schemaLanguage | Specifies the schema language which the returned `SchemaFactory` will understand. `schemaLanguage` must specify a [valid](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory#schemaLanguage) schema language. |
|---|---|

##### Returns

- `true` if `SchemaFactory` supports `schemaLanguage`, else `false`.

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | If `schemaLanguage` is `null`. |
| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | If `schemaLanguage.length() == 0` or `schemaLanguage` does not specify a [valid](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory#schemaLanguage) schema language. |
|---|---|

#### public static [SchemaFactory](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html)
**newInstance**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) schemaLanguage, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) factoryClassName, [ClassLoader](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/ClassLoader.html) classLoader)

Returns an instance of the named implementation of `SchemaFactory`.

##### Parameters

| schemaLanguage |   |
| factoryClassName |   |
| classLoader |   |
|---|---|

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if `factoryClassName` is not available, cannot be instantiated, or doesn't support `schemaLanguage`. |
|---|---|

#### public static [SchemaFactory](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html)
**newInstance**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) schemaLanguage)

<br />

Lookup an implementation of the `SchemaFactory` that supports the specified
schema language and return it.

To find a `SchemaFactory` object for a given schema language,
this method looks the following places in the following order
where "the class loader" refers to the context class loader:

1. If the system property `"javax.xml.validation.SchemaFactory:*schemaLanguage*"` is present (where *schemaLanguage* is the parameter to this method), then its value is read as a class name. The method will try to create a new instance of this class by using the class loader, and returns it if it is successfully created.
2. `$java.home/lib/jaxp.properties` is read and the value associated with the key being the system property above is looked for. If present, the value is processed just like above.
3. The class loader is asked for service provider provider-configuration files matching
   `javax.xml.validation.SchemaFactory` in the resource directory META-INF/services.
   See the JAR File Specification for file format and parsing rules.
   Each potential service provider is required to implement the method:

               https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#isSchemaLanguageSupported(java.lang.String)
            
   The first service provider found in class loader order that supports the specified schema language is returned.
4. Platform default `SchemaFactory` is located in a implementation specific way. There must be a platform default `SchemaFactory` for W3C XML Schema.

If everything fails, `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html` will be thrown.

**Tip for Trouble-shooting:**

See `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Properties.html#load(java.io.InputStream)` for
exactly how a property file is parsed. In particular, colons ':'
need to be escaped in a property file, so make sure schema language
URIs are properly escaped in it. For example:

```
 http\://www.w3.org/2001/XMLSchema=org.acme.foo.XSSchemaFactory
 
```

<br />

##### Parameters

| schemaLanguage | Specifies the schema language which the returned SchemaFactory will understand. See [the list of available schema languages](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory#schemaLanguage) for the possible values. |
|---|---|

##### Returns

- New instance of a `SchemaFactory`

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | If no implementation of the schema language is available. |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | If the schemaLanguage parameter is null. |
|---|---|

#### public [Schema](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html)
**newSchema**
([File](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/File.html) schema)

<br />

Parses the specified `File` as a schema and returns it as a `Schema`.

This is a convenience method for `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#newSchema(javax.xml.transform.Source)`.

<br />

##### Parameters

| schema | File that represents a schema. |
|---|---|

##### Returns

- New `Schema` from parsing `schema`.

##### Throws

| [SAXException](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXException.html) | If a SAX error occurs during parsing. |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if schema is null. |
|---|---|

#### public [Schema](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html)
**newSchema**
([Source](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/Source.html) schema)

<br />

Parses the specified source as a schema and returns it as a schema.

This is a convenience method for `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#newSchema(javax.xml.transform.Source[])`.

<br />

##### Parameters

| schema | Source that represents a schema. |
|---|---|

##### Returns

- New `Schema` from parsing `schema`.

##### Throws

| [SAXException](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXException.html) | If a SAX error occurs during parsing. |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if schema is null. |
|---|---|

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

Creates a special `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html` object.


The exact semantics of the returned `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html` object depends
on the schema language that this `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` is created
for.


Also, implementations are allowed to use implementation-specific
property/feature to alter the semantics of this method.


## W3C XML Schema 1.0


For XML Schema, this method creates a `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html` object that
performs validation by using location hints specified in documents.


The returned `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html` object assumes that if documents
refer to the same URL in the schema location hints,
they will always resolve to the same schema document. This
assumption allows implementations to reuse parsed results of
schema documents so that multiple validations against the same
schema will run faster.


Note that the use of schema location hints introduces a
vulnerability to denial-of-service attacks.


## RELAX NG


RELAX NG does not support this operation.

##### Returns

- Always return non-null valid `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html` object.

##### Throws

| [UnsupportedOperationException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/UnsupportedOperationException.html) | If this operation is not supported by the callee. |
| [SAXException](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXException.html) | If this operation is supported but failed for some reason. |
|---|---|

#### public abstract [Schema](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html)
**newSchema**
([Source\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/Source.html) schemas)

Parses the specified source(s) as a schema and returns it as a schema.


The callee will read all the `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/Source.html`s and combine them into a
single schema. The exact semantics of the combination depends on the schema
language that this `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` object is created for.


When an `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html` is set, the callee will report all the errors
found in sources to the handler. If the handler throws an exception, it will
abort the schema compilation and the same exception will be thrown from
this method. Also, after an error is reported to a handler, the callee is allowed
to abort the further processing by throwing it. If an error handler is not set,
the callee will throw the first error it finds in the sources.

## 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 behavior between
JAXP-compliant parsers may vary; in particular, parsers may choose
to ignore all but the first \<import\> for a given namespace,
regardless of information provided in schemaLocation.


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 `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html`.

## RELAX NG

For RELAX NG, this method must throw `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/UnsupportedOperationException.html`
if schemas.length!=1.

##### Parameters

| schemas | inputs to be parsed. `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` is required to recognize `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/stream/StreamSource.html`, `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/sax/SAXSource.html`, and `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/dom/DOMSource.html`. |
|---|---|

##### Returns

- Always return a non-null valid `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html` object. Note that when an error has been reported, there is no guarantee that the returned `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html` object is meaningful.

##### Throws

| [SAXException](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXException.html) | If an error is found during processing the specified inputs. When an `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html` is set, errors are reported to there first. See `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#setErrorHandler(org.xml.sax.ErrorHandler)`. |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | If the `schemas` parameter itself is null or any item in the array is null. |
| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | If any item in the array is not recognized by this method. |
| [UnsupportedOperationException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/UnsupportedOperationException.html) | If the schema language doesn't support this operation. |
|---|---|

#### public [Schema](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html)
**newSchema**
([URL](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/URL.html) schema)

<br />

Parses the specified `URL` as a schema and returns it as a `Schema`.

This is a convenience method for `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#newSchema(javax.xml.transform.Source)`.

<br />

##### Parameters

| schema | `URL` that represents a schema. |
|---|---|

##### Returns

- New `Schema` from parsing `schema`.

##### Throws

| [SAXException](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXException.html) | If a SAX error occurs during parsing. |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if schema is null. |
|---|---|

#### public abstract void
**setErrorHandler**
([ErrorHandler](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html) errorHandler)

Sets the `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html` to receive errors encountered
during the `newSchema` method invocation.


Error handler can be used to customize the error handling process
during schema parsing. When an `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html` is set,
errors found during the parsing of schemas will be first sent
to the `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html`.


The error handler can abort the parsing of a schema immediately
by throwing `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXException.html` from the handler. Or for example
it can print an error to the screen and try to continue the
processing by returning normally from the `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html`


If any `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html` (or instances of its derived classes)
is thrown from an `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html`,
the caller of the `newSchema` method will be thrown
the same `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html` object.


`https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` is not allowed to
throw `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXException.html` without first reporting it to
`https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html`.


Applications can call this method even during a `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html`
is being parsed.


When the `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html` is null, the implementation will
behave as if the following `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html` is set:

     class DraconianErrorHandler implements https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html {
         public void fatalError( https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXParseException.html e ) throws https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXException.html {
             throw e;
         }
         public void error( https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXParseException.html e ) throws https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXException.html {
             throw e;
         }
         public void warning( https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXParseException.html e ) throws https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXException.html {
             // noop
         }
     }
     

When a new `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` object is created, initially
this field is set to null. This field will *NOT* be
inherited to `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html`s, `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Validator.html`s, or
`https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/ValidatorHandler.html`s that are created from this `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html`.

##### Parameters

| errorHandler | A new error handler to be set. This parameter can be null. |
|---|---|

#### public void
**setFeature**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name, boolean value)

Set the value of a feature flag.


Feature can be used to control the way a `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html`
parses schemas, although `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html`s are not required
to recognize any specific feature names.

The feature name is any fully-qualified URI. It is
possible for a `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` to expose a feature value but
to be unable to change the current value.

All implementations are required to support the `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/XMLConstants.html#FEATURE_SECURE_PROCESSING` feature.
When the feature is:

- `true`: the implementation will limit XML processing to conform to implementation limits. Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources. If XML processing is limited for security reasons, it will be reported via a call to the registered `https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/ErrorHandler.html#fatalError(org.xml.sax.SAXParseException)`. See `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#setErrorHandler(org.xml.sax.ErrorHandler)`.
- `false`: the implementation will processing XML according to the XML specifications without regard to possible implementation limits.

<br />

##### Parameters

| name | The feature name, which is a non-null fully-qualified URI. |
| value | The requested value of the feature (true or false). |
|---|---|

##### Throws

| [SAXNotRecognizedException](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXNotRecognizedException.html) | If the feature value can't be assigned or retrieved. |
| [SAXNotSupportedException](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXNotSupportedException.html) | When the `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` recognizes the feature name but cannot set the requested value. |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if the name parameter is null. |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html#getFeature(java.lang.String)`

#### public void
**setProperty**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name, [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) object)

Set the value of a property.

The property name is any fully-qualified URI. It is
possible for a `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` to recognize a property name but
to be unable to change the current value.

`https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html`s are not required to recognize setting
any specific property names.

<br />

##### Parameters

| name | The property name, which is a non-null fully-qualified URI. |
| object | The requested value for the property. |
|---|---|

##### Throws

| [SAXNotRecognizedException](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXNotRecognizedException.html) | If the property value can't be assigned or retrieved. |
| [SAXNotSupportedException](https://developers.google.com/j2objc/javadoc/jre/reference/org/xml/sax/SAXNotSupportedException.html) | When the `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` recognizes the property name but cannot set the requested value. |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if the name parameter is null. |
|---|---|

#### public abstract void
**setResourceResolver**
([LSResourceResolver](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/ls/LSResourceResolver.html) resourceResolver)

Sets the `https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/ls/LSResourceResolver.html` to customize
resource resolution when parsing schemas.


`https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` uses a `https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/ls/LSResourceResolver.html`
when it needs to locate external resources while parsing schemas,
although exactly what constitutes "locating external resources" is
up to each schema language. For example, for W3C XML Schema,
this includes files \<include\>d or \<import\>ed,
and DTD referenced from schema files, etc.


Applications can call this method even during a `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html`
is being parsed.


When the `https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/ls/LSResourceResolver.html` is null, the implementation will
behave as if the following `https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/ls/LSResourceResolver.html` is set:

     class DumbDOMResourceResolver implements https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/ls/LSResourceResolver.html {
         public https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/ls/LSInput.html resolveResource(
             String publicId, String systemId, String baseURI) {

             return null; // always return null
         }
     }
     

If a `https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/ls/LSResourceResolver.html` throws a `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/RuntimeException.html`
(or instances of its derived classes),
then the `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` will abort the parsing and
the caller of the `newSchema` method will receive
the same `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/RuntimeException.html`.


When a new `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html` object is created, initially
this field is set to null. This field will *NOT* be
inherited to `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Schema.html`s, `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/Validator.html`s, or
`https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/ValidatorHandler.html`s that are created from this `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/validation/SchemaFactory.html`.

##### Parameters

| resourceResolver | A new resource resolver to be set. This parameter can be null. |
|---|---|