Package com.saxonica.ee.schema.sdoc
Class SchemaReader
- java.lang.Object
-
- com.saxonica.ee.schema.sdoc.SchemaReader
-
public abstract class SchemaReader extends java.lang.Object
A class for reading XML Schema documents. The class is not instantiated, its methods are static.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SchemaDocument
buildSchemaDocument(javax.xml.transform.Source source, SchemaCompiler compiler, PipelineConfiguration pipe, SchemaElement referrer)
Build the tree representation of a schema document, without doing any processing or XSD-specific validation of the contentstatic javax.xml.transform.Source
getSource(java.lang.String baseURI, java.lang.String relativeURI, SchemaCompiler compiler, java.lang.String targetNamespace)
Resolve and dereference a URI to get a Source object representing a schema documentstatic javax.xml.transform.Source[]
getSources(java.lang.String baseURI, java.lang.String[] relativeURIs, SchemaCompiler compiler, java.lang.String targetNamespace)
Resolve and dereference a set of URIs to get a set of Source objects representing schema documentsstatic SchemaDocument
read(javax.xml.transform.Source source, SchemaCompiler compiler, PipelineConfiguration pipe, SchemaElement referrer)
Read the Schema from a source XML document and return the Schema document.static void
setupSourceWithReader(javax.xml.transform.Source source, SchemaCompiler compiler, Valve valve, Configuration config, ParseOptions options)
-
-
-
Method Detail
-
getSource
public static javax.xml.transform.Source getSource(java.lang.String baseURI, java.lang.String relativeURI, SchemaCompiler compiler, java.lang.String targetNamespace) throws SchemaException
Resolve and dereference a URI to get a Source object representing a schema document- Parameters:
baseURI
- the base URIrelativeURI
- the URI to be resolved relative to the base URIcompiler
- the pipeline configuration (which may define a URIResolver to be used)targetNamespace
- the targetNamespace of the schema document required (this is set to null when doing an include or redefine, because in those cases the targetNamespace cannot be used to locate the schema document)- Returns:
- the JAXP Source object representing the deferenced URI, or null if no source could be located
- Throws:
SchemaException
- if any errors occur
-
getSources
public static javax.xml.transform.Source[] getSources(java.lang.String baseURI, java.lang.String[] relativeURIs, SchemaCompiler compiler, java.lang.String targetNamespace) throws SchemaException
Resolve and dereference a set of URIs to get a set of Source objects representing schema documents- Parameters:
baseURI
- the base URIrelativeURIs
- the URIs (location hints) to be resolved relative to the base URIcompiler
- the pipeline configuration (which may define a URIResolver to be used)targetNamespace
- the targetNamespace of the schema document required (this is set to null when doing an include or redefine, because in those cases the targetNamespace cannot be used to locate the schema document)- Returns:
- the JAXP Source object representing the deferenced URI
- Throws:
SchemaException
- if any errors occur
-
read
public static SchemaDocument read(javax.xml.transform.Source source, SchemaCompiler compiler, PipelineConfiguration pipe, SchemaElement referrer) throws SchemaException
Read the Schema from a source XML document and return the Schema document. The schema document is validated against the XML Representation Constraints, but the resulting schema components are not validated against schema component constraints: this must be done by the caller after all schema components are assembled, by callingSchemaCompiler.validate(com.saxonica.ee.schema.sdoc.SchemaDocument)
- Parameters:
source
- the JAXP Source containing the schema document. This may be either a source XSD schema document, or a compiled SCM schema document.compiler
- used for tracking source documents read, and for error reportingpipe
- the pipeline configurationreferrer
- if the schema document is referenced from an xs:import, xs:include, or xs:redefined, this parameter identifies that element; otherwise, null.- Returns:
- the new SchemaDocument created from the source of this SchemaReader. This may be either a source XSD schema document, or a compiled SCM schema document.
- Throws:
SchemaException
- if the schema module can't be read or parsed, or if the schema module is an invalid schema
-
buildSchemaDocument
public static SchemaDocument buildSchemaDocument(javax.xml.transform.Source source, SchemaCompiler compiler, PipelineConfiguration pipe, SchemaElement referrer) throws SchemaException
Build the tree representation of a schema document, without doing any processing or XSD-specific validation of the content- Parameters:
source
- the source of the modulecompiler
- the SchemaCompiler (holds configuration information and keeps track of errors)pipe
- the Pipeline Configurationreferrer
- the xs:import or xs:include element, etc, that requested processing of this module- Returns:
- the root Document node of the tree containing the schema document
- Throws:
SchemaException
- if XML parsing or tree construction fails
-
setupSourceWithReader
public static void setupSourceWithReader(javax.xml.transform.Source source, SchemaCompiler compiler, Valve valve, Configuration config, ParseOptions options) throws XPathException
- Throws:
XPathException
-
-