public class XmlSchemaCompiler extends Object
Schema object: an immutable in-memory
representation of one or more grammars spanning one or more target
namespaces.
An OASIS entity catalog is used to resolve schema references. Note that, in
general, the top-level schema entity is never passed to the
LSResourceResolver object set on a SchemaFactory. However an instance of this
class will use the catalog to resolve the given URI reference, thus enabling
redirection to a local copy of the schema. If a matching entry (system id or
namespace name) is not found, a regular URI connection to the resource should
be established.| Constructor and Description |
|---|
XmlSchemaCompiler(URL catalog)
Constructs and configures an XmlSchemaCompiler to use an OASIS entity
catalog to resolve schema references.
|
| Modifier and Type | Method and Description |
|---|---|
Schema |
compileXmlSchema(Source... xsdSources)
Compiles a sequence of W3C XML Schema resources that may be used to
perform grammar-based validation of an XML instance.
|
Schema |
compileXmlSchema(URI... schemaURIs)
Compiles W3C XML Schema resources obtained from the specified sequence of
URI references.
|
(package private) File |
dereferenceURI(URI schemaURI)
Dereferences the given URI and writes the resulting entity (XML Schema)
to a local file.
|
ValidationErrorHandler |
getErrorHandler()
Returns the specialized error handler used to collect all errors
encountered while parsing schemas.
|
(package private) String |
lookupSchemaByURI(URI uri)
Looks up a (schema) URI in an entity catalog by system identifier or
namespace name.
|
public XmlSchemaCompiler(URL catalog)
catalog - An absolute URL specifying the location of an OASIS entity
catalog.public ValidationErrorHandler getErrorHandler()
public Schema compileXmlSchema(URI... schemaURIs) throws SAXException, IOException
schemaURIs - A sequence (or array) of absolute URIs representing schema
locations.null if
compilation failed for any reason.SAXException - If an error occurs while attempting to read a schema.IOException - If an error occurs while attempting to retrieve a schema.public Schema compileXmlSchema(Source... xsdSources) throws SAXException
xsdSources - A sequence (or array) of Source objects used to read the input
schemas.null if
compilation failed for any reason.SAXException - If an error occurs while attempting to compile the schema
(e.g. it's malformed).String lookupSchemaByURI(URI uri)
uri - An absolute URI referring to an XML Schema resource.File dereferenceURI(URI schemaURI) throws IOException
java.net.SocketTimeoutException is raised.schemaURI - An absolute URI reference.IOException - If the resource cannot be retrieved.Copyright © 2016 Open Geospatial Consortium. All rights reserved.