Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.saxonica.schema
Class SchemaCompiler

    java.lang.Object
      com.saxonica.schema.SchemaCompiler

All Implemented Interfaces:
  ISchemaCompiler

    public class SchemaCompiler

extends Object
implements ISchemaCompiler

A SchemaCompiler is capable of reading source schema documents and converting them into collections of schema components. The Compiler holds all the options relating to schema compilation.

A default SchemaCompiler is available as part of the SchemaAwareConfiguration

Since:
  8.9

Constructor Summary
`SchemaCompiler(SchemaAwareConfiguration config)`

Method Summary
`void` | `addPendingTypeCheck(IdentityConstraint constraint, SchemaType contextItemType)` Register an identity constraint that needs to be type-checked
`void` | `error(String message, SourceLocator locator)` Report an error
`SchemaAwareConfiguration` | `getConfiguration()` Get the configuration
`int` | `getErrorCount()` Test whether errors have been reported
`ErrorListener` | `getErrorListener()` Get the ErrorListener used in this configuration.
`NamePool` | `getNamePool()` Get the NamePool
`int[]` | `getOccurrenceLimits()` Get the occurrence limits previously set using setOccurrenceLimits (or the default)
`PreparedSchema` | `getPreparedSchema()` Get the PreparedSchema.
`SchemaDocumentManager` | `getSchemaDocumentManager()` Get the schema document manager, which keeps track of schema documents processed by this schema compiler
`SchemaURIResolver` | `getSchemaURIResolver()` Get the user-defined SchemaURIResolver for resolving URIs used in "import schema" declarations; if none has been explicitly set, returns the standard schema URI resolver.
`String` | `readInlineSchema(NodeInfo root, String expected, ErrorListener errorListener)` Read an inline schema from a stylesheet
`void` | `readMultipleSchemas(PipelineConfiguration pipe, String baseURI, List schemaLocations, String expected)` Read schemas from a list of schema locations
`String` | `readSchema(PipelineConfiguration pipe, String baseURI, String schemaLocation, String expected)` Read a schema from a given schema location
`void` | `setErrorListener(ErrorListener listener)` Set the ErrorListener to be used in this compiler.
`void` | `setOccurrenceLimits(int minimum, int maximum)` Set the occurrence limits to be used when compiling a finite state automaton.
`void` | `typeCheckIdentityConstraints()` Do all the pending type-checking
`PreparedSchema` | `validate(SchemaDocument doc)` Validate the schema represented by a schema document.
`void` | `warning(String message, SourceLocator locator)` Report a warning

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SchemaCompiler

    public SchemaCompiler(SchemaAwareConfiguration config)

Method Detail

### getConfiguration

    public SchemaAwareConfiguration getConfiguration()

  Get the configuration

### getNamePool

    public NamePool getNamePool()

  Get the NamePool

### getPreparedSchema

    public PreparedSchema getPreparedSchema()

  Get the PreparedSchema. This is a callback available only during a schema validation episode

### getSchemaDocumentManager

    public SchemaDocumentManager getSchemaDocumentManager()

  Get the schema document manager, which keeps track of schema documents processed by this schema compiler

### getErrorListener

    public ErrorListener getErrorListener()

  Get the ErrorListener used in this configuration. If no ErrorListener has been supplied explicitly, the default ErrorListener is used.

  Returns:
    the ErrorListener.
  Since:
    8.9

### setErrorListener

    public void setErrorListener(ErrorListener listener)

  Set the ErrorListener to be used in this compiler. The ErrorListener is informed of all errors detected during schema processing.

  Parameters:
    `listener` - the ErrorListener to be used
  Since:
    8.9

### getErrorCount

    public int getErrorCount()

  Test whether errors have been reported

### setOccurrenceLimits

    public void setOccurrenceLimits(int minimum,
                                    int maximum)

  Set the occurrence limits to be used when compiling a finite state automaton.

  Parameters:
    `minimum` - The highest value of minOccurs that will be strictly enforced. If the actual value of minOccurs in a schema is higher than this value, it will be treated as if this value had been specified. The default is 100.
    `maximum` - The highest value of maxOccurs that will be strictly enforced. If the actual value of maxOccurs in a schema is higher than this value, it will be treated as if "unbounded" had been specified. The default is 250.
  Since:
    8.9

### getOccurrenceLimits

    public int[] getOccurrenceLimits()

  Get the occurrence limits previously set using setOccurrenceLimits (or the default)

  Returns:
    an array of two integers, the minimum occurrence limit and the maximum occurrence limit
  Since:
    8.9

### getSchemaURIResolver

    public SchemaURIResolver getSchemaURIResolver()

  Get the user-defined SchemaURIResolver for resolving URIs used in "import schema" declarations; if none has been explicitly set, returns the standard schema URI resolver.

### readSchema

    public String readSchema(PipelineConfiguration pipe,
                             String baseURI,
                             String schemaLocation,
                             String expected)
                      throws SchemaException

  Read a schema from a given schema location

  Parameters:
    `pipe` -
    `baseURI` - the base URI for resolving relative URIs
    `schemaLocation` - the location "hint" where to find the schema document. Must not be null.
    `expected` - the target namespace expected; null if there is no expectation
  Returns:
    the actual target namespace of the schema
  Throws:
    `SchemaException`

### readMultipleSchemas

    public void readMultipleSchemas(PipelineConfiguration pipe,
                                    String baseURI,
                                    List schemaLocations,
                                    String expected)
                             throws SchemaException

  Read schemas from a list of schema locations

  Parameters:
    `pipe` -
    `baseURI` - the base URI for resolving relative URIs
    `schemaLocations` - the list of location "hints" where to find the schema document. Must not be null.
    `expected` - the target namespace expected in each of the schema documents; null if there is no expectation
  Throws:
    `SchemaException`

### readInlineSchema

    public String readInlineSchema(NodeInfo root,
                                   String expected,
                                   ErrorListener errorListener)
                            throws SchemaException

  Read an inline schema from a stylesheet

  Parameters:
    `root` - the xs:schema element in the stylesheet
    `expected` - the target namespace expected; "" if there is no expectation
    `errorListener` - The destination for error messages. May be null, in which case the errorListener registered with this Configuration is used.
  Returns:
    the actual target namespace of the schema
  Throws:
    `SchemaException`

### validate

    public PreparedSchema validate(SchemaDocument doc)
                            throws SchemaException

  Validate the schema represented by a schema document. This method validates the schema components associated with this schema document: that is, the components defined in this document, together with any components referenced by these components if they have not already been validated.

  Parameters:
    `doc` - the schema document to be validated
  Returns:
    schema the schema, if it is valid
  Throws:
    `SchemaException` - if the schema is invalid

### error

    public void error(String message,
                      SourceLocator locator)
               throws SchemaException

  Report an error

  Throws:
    `SchemaException`

### warning

    public void warning(String message,
                        SourceLocator locator)

  Report a warning

### addPendingTypeCheck

    public void addPendingTypeCheck(IdentityConstraint constraint,
                                    SchemaType contextItemType)

  Register an identity constraint that needs to be type-checked

### typeCheckIdentityConstraints

    public void typeCheckIdentityConstraints()

  Do all the pending type-checking

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Michael H. Kay. All rights reserved.