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 Sources and combine them into a single schema. The exact semantics of the combination depends on the schema language that this SchemaFactory object is created for.

When an ErrorHandler 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 behaviour 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 ErrorHandler.

RELAX NG

For RELAX NG, this method must throw UnsupportedOperationException if schemas.length!=1.

Parameters:
schemas     inputs to be parsed. SchemaFactory is required to recognize javax.xml.transform.sax.SAXSource, StreamSource, javax.xml.transform.stax.StAXSource, and javax.xml.transform.dom.DOMSource. 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.

Returns:  Always return a non-null valid Schema object. Note that when an error has been reported, there is no guarantee that the returned Schema object is meaningful.

Exceptions:
SAXException     If an error is found during processing the specified inputs. When an ErrorHandler is set, errors are reported to there first. See setErrorHandler(ErrorHandler).
NullPointerException     If the schemas parameter itself is null or any item in the array is null.
IllegalArgumentException     If any item in the array is not recognized by this method.
UnsupportedOperationException     If the schema language doesn't support this operation.