Class XsdCompilerEE

java.lang.Object
net.sf.saxon.s9api.XsdCompiler
com.saxonica.ee.s9api.XsdCompilerEE

public class XsdCompilerEE extends XsdCompiler
An XsdCompilerEE is used to load schema documents, and to set options for the way in which they are loaded.
  • Constructor Details

    • XsdCompilerEE

      public XsdCompilerEE(Processor processor)
  • Method Details

    • getProcessor

      public Processor getProcessor()
      Get the associated s9api processor
      Specified by:
      getProcessor in class XsdCompiler
      Returns:
      the Processor
    • setXsdVersion

      public void setXsdVersion(String version)
      Set the version of XSD in use for this schema. The value must be "1.0" or "1.1". The default is taken from the configuration property Feature.XSD_VERSION at the time the XsdSchemaCompiler is instantiated. By default this is "1.1".
      Specified by:
      setXsdVersion in class XsdCompiler
      Parameters:
      version - the version of the XSD specification/language: either "1.0" or "1.1".
    • getXsdVersion

      public String getXsdVersion()
      Get the version of XSD in use. The value will be "1.0" or "1.1"
      Specified by:
      getXsdVersion in class XsdCompiler
      Returns:
      the version of XSD in use.
    • setErrorReporter

      public void setErrorReporter(ErrorReporter reporter)
      Set the ErrorReporter to be used while loading and validating schema documents
      Specified by:
      setErrorReporter in class XsdCompiler
      Parameters:
      reporter - The error reporter to be used. This is notified of all errors detected during the compilation. May be set to null to revert to the default ErrorReporter.
    • getErrorReporter

      public ErrorReporter getErrorReporter()
      Get the ErrorReporter being used while loading and validating schema documents
      Specified by:
      getErrorReporter in class XsdCompiler
      Returns:
      reporter The error reporter in use. This is notified of all errors detected during the compilation. Returns null if no user-supplied ErrorReporter has been set.
    • setSchemaURIResolver

      public void setSchemaURIResolver(SchemaURIResolver resolver)
      Set the SchemaURIResolver to be used during schema loading. This SchemaURIResolver, despite its name, is not used for resolving relative URIs against a base URI; it is used for dereferencing an absolute URI (after resolution) to return a Source representing the location where a schema document can be found.

      This SchemaURIResolver is used to dereference the URIs appearing in xs:import, xs:include, and xs:redefine declarations.

      Specified by:
      setSchemaURIResolver in class XsdCompiler
      Parameters:
      resolver - the SchemaURIResolver to be used during schema loading.
    • getSchemaURIResolver

      public SchemaURIResolver getSchemaURIResolver()
      Get the SchemaURIResolver to be used during schema loading.
      Specified by:
      getSchemaURIResolver in class XsdCompiler
      Returns:
      the URIResolver used during stylesheet compilation. Returns null if no user-supplied URIResolver has been set.
    • compile

      public XsdSchema compile(Source... sources) throws SaxonApiException
      Load schema documents from given Sources. The schema components derived from this schema document are added to the cache of schema components maintained by this SchemaManager.

      If the source is a StreamSource containing a systemId but no InputStream or Reader, then an attempt is made to resolve the systemId using the resource resolver registered with the Configuration. It is NOT resolved using the SchemaURIResolver (this is used only for included and imported modules).

      Specified by:
      compile in class XsdCompiler
      Parameters:
      sources - the documents containing the schema. The getSystemId() method applied to each Source must return a base URI suitable for resolving xs:include and xs:import directives. The document may be either a schema document in source XSD format, or a compiled schema in Saxon-defined SCM format (as produced using the -export option)
      Returns:
      the resulting schema.
      Throws:
      SaxonApiException - if the schema document is not valid, or if its contents are inconsistent with the schema components already held by this SchemaManager. Note that the method returns without an exception if one or more of the sources cannot be processed, provided that the remaining documents constitute a valid schema.
    • compile

      public XsdSchema compile(File... files) throws SaxonApiException
      Load a schema document from a given File or set of files. The schema components derived from this schema document are retained by this SchemaManager as the current schema, and are also returned by the method as an XsdSchema object.
      Specified by:
      compile in class XsdCompiler
      Parameters:
      files - the documents containing the schema. The getSystemId() method applied to this Source must return a base URI suitable for resolving xs:include and xs:import directives. The document may be either a schema document in source XSD format, or a compiled schema in Saxon-defined SCM format (as produced using the -export option)
      Returns:
      the resulting schema.
      Throws:
      SaxonApiException - if the schema document is not valid.
    • combine

      public XsdSchema combine(XsdSchema... schemas) throws SaxonApiException
      Combine a set of schemas into one
      Specified by:
      combine in class XsdCompiler
      Parameters:
      schemas - the input schemas. These are not modified.
      Returns:
      the combined schema
      Throws:
      SaxonApiException - if the schemas are not compatible, for example if they contain duplicate names.
      Since:
      13.0
    • emptySchema

      public XsdSchema emptySchema()
      Return an empty schema. This may be useful for validating instance documents when all the actual schema definitions are linked from the instance document using xsi:schemaLocation and xsi:noNamespaceSchemaLocation attributes
      Specified by:
      emptySchema in class XsdCompiler
      Returns:
      an empty schema
    • importComponents

      public XsdSchema importComponents(Source source) throws SaxonApiException
      Import a precompiled Schema Component Model from a given Source. The schema components derived from this schema document are added to the cache of schema components maintained by this SchemaManager
      Specified by:
      importComponents in class XsdCompiler
      Parameters:
      source - the XML file containing the schema component model, as generated by a previous call on XsdSchema.exportComponents(net.sf.saxon.s9api.Destination)
      Returns:
      the schema that results from importing the SCM file
      Throws:
      SaxonApiException
    • wrapInternalSchema

      public XsdSchema wrapInternalSchema(Schema internalSchema)
      Construct an XsdSchema by wrapping an internal schema object. This is intended primarily for internal use
      Specified by:
      wrapInternalSchema in class XsdCompiler
      Parameters:
      internalSchema - the internal schema object