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

## com.saxonica.schema
Class PreparedSchema

    java.lang.Object
      com.saxonica.schema.SchemaStructure
          com.saxonica.schema.PreparedSchema

All Implemented Interfaces:
  java.io.Serializable, javax.xml.transform.SourceLocator

public class PreparedSchema
extends SchemaStructure

A schema is a collection of schema components. It is derived from a schema document (an xs:schema element), and contains those components defined in that schema document, the components defined in the included documents (expanded transitively), and the components defined in imported schema documents (not expanded transitively).

See Also:
  Serialized Form

Constructor Summary
`PreparedSchema(SchemaAwareConfiguration config)` Create a new Schema definition

Method Summary
`void` | `addAnonymousType(SchemaType type)` Register an anonymous type defined in this schema
`void` | `addAttribute(AttributeDecl attribute)` Adds the given global attribute declaration to this Schema.
`void` | `addAttributeGroup(AttributeGroupDecl attributeGroup)` Adds the given global attribute declaration to this Schema.
`void` | `addComponent(UserSchemaComponent obj)` Add an object that might contain a forwards reference to be fixed up later
`void` | `addElementDecl(ElementDecl elementDecl)` Adds the given global element declaration to this Schema definition
`void` | `addGroup(ModelGroupDefinition group)` Adds the given group (xs:group) to this Schema.
`void` | `addIdentityConstraint(IdentityConstraint constraint)` Add an identity constraint
`void` | `addNotation(Notation notation)` Adds the given Notation declaration to this Schema defintion
`void` | `addSimpleType(SimpleTypeDefinition simpleType)` Adds the given named SimpleType definition to this Schema.
`void` | `addType(SchemaType type)` Adds the given type definition to this Schema.
`void` | `copyTo(PreparedSchema destination)` Copy the components of this schema to another schema
`void` | `error(java.lang.String message, javax.xml.transform.SourceLocator locator)` Report an error
`AttributeDecl` | `getAttributeDecl(int fingerprint)` Get the attribute declaration with a given name if there is one.
`AttributeGroupDecl` | `getAttributeGroup(int fingerprint)` Get the attribute declaration with a given name if there is one.
`SchemaAwareConfiguration` | `getConfiguration()` Get the configuration
`ElementDecl` | `getElementDecl(int fingerprint)` Get the global element declaration with a given name
`int` | `getErrorCount()` Test whether errors have been reported
`ModelGroupDefinition` | `getGroup(int fingerprint)` Get the group with a given name if there is one.
`IdentityConstraint` | `getIdentityConstraint(int fingerprint)` Get the identity constraint whose name has a given fingerprint
`NamePool` | `getNamePool()` Get the NamePool used by this schema
`Notation` | `getNotation(int fingerprint)` Get the notation with a given name
`java.lang.String` | `getSchemaLocation()` Returns the schemaLocation hint provided for this schema
`SchemaType` | `getSchemaType(int fingerprint)` Get the type with a given name if there is one.
`SimpleType` | `getSimpleType(int fingerprint)` Get the simple type with a given name if there is one.
`java.lang.String` | `getTargetNamespace()` Returns the target namespace for this Schema, or "" if no namespace has been defined.
`SchemaType` | `getType(int fingerprint)` Get type defined in this schema, searching both named and anonymous types
`java.lang.String` | `getVersion()` Returns the version information of the XML Schema definition represented by this Schema instance.
`static PreparedSchema` | `merge(PreparedSchema ps1, PreparedSchema ps2)` Merge two PreparedSchemas into one, rejecting any components that are defined in both.
`javax.xml.validation.Validator` | `newValidator()`
`javax.xml.validation.ValidatorHandler` | `newValidatorHandler()`
`void` | `setConfiguration(SchemaAwareConfiguration config)` Set the configuration
`void` | `setSchemaLocation(java.lang.String schemaLocation)` Set the schemaLocation for this schema.
`void` | `setTargetNamespace(java.lang.String targetNamespace)` Sets the target namespace for this Schema
`void` | `setVersion(java.lang.String version)` Sets the version information for the XML Schema defintion represented by this Schema instance.
`boolean` | `validate(javax.xml.transform.ErrorListener errorListener)` Checks the validity of this Schema definition.
`SchemaComponent` | `validateReference(ComponentReference ref)` Helper method to validate that a reference to a schema component can be resolved

Methods inherited from class com.saxonica.schema.SchemaStructure
`getColumnNumber, getFixupStatus, getLineNumber, getPublicId, getSchema, getSystemId, getValidationStatus, lookForCycles, setFixupStatus, setLineNumber, setLocator, setSchema, setSystemId, setValidationStatus`

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

Constructor Detail

### PreparedSchema

    public PreparedSchema(SchemaAwareConfiguration config)

  Create a new Schema definition

Parameters:
  `config` - The configuration object holding system configuration information

Method Detail

### setConfiguration

    public void setConfiguration(SchemaAwareConfiguration config)

  Set the configuration

### getConfiguration

    public SchemaAwareConfiguration getConfiguration()

  Get the configuration

### addComponent

    public void addComponent(UserSchemaComponent obj)

  Add an object that might contain a forwards reference to be fixed up later

### getAttributeDecl

    public AttributeDecl getAttributeDecl(int fingerprint)

  Get the attribute declaration with a given name if there is one.

  Returns:
    the attribute declaration if found, or null otherwise

### addAttribute

    public void addAttribute(AttributeDecl attribute)

  Adds the given global attribute declaration to this Schema. It will overwrite any existing attribute declaration with the same name.

  Parameters:
    `attribute` - the AttributeDecl to add

### getAttributeGroup

    public AttributeGroupDecl getAttributeGroup(int fingerprint)

  Get the attribute declaration with a given name if there is one.

  Returns:
    the attribute declaration if found, or null otherwise

### addAttributeGroup

    public void addAttributeGroup(AttributeGroupDecl attributeGroup)

  Adds the given global attribute declaration to this Schema. It will overwrite any existing attribute declaration with the same name.

  Parameters:
    `attributeGroup` - the AttributeDecl to add

### getGroup

    public ModelGroupDefinition getGroup(int fingerprint)

  Get the group with a given name if there is one.

  Returns:
    the group if found, or null otherwise

### addGroup

    public void addGroup(ModelGroupDefinition group)

  Adds the given group (xs:group) to this Schema. It will overwrite any existing group with the same name.

  Parameters:
    `group` - the group to add

### getSchemaType

    public SchemaType getSchemaType(int fingerprint)

  Get the type with a given name if there is one.

  Returns:
    the simple or complex type if found, or null otherwise

### getSimpleType

    public SimpleType getSimpleType(int fingerprint)

  Get the simple type with a given name if there is one.

  Returns:
    the simple type if found, or null otherwise

### addType

    public void addType(SchemaType type)

  Adds the given type definition to this Schema. If another type with this name already exists, it is overwritten.

  Parameters:
    `type` - the type to add to this Schema

### addAnonymousType

    public void addAnonymousType(SchemaType type)

  Register an anonymous type defined in this schema

### getType

    public SchemaType getType(int fingerprint)

  Get type defined in this schema, searching both named and anonymous types

### addElementDecl

    public void addElementDecl(ElementDecl elementDecl)
                        throws SchemaException

  Adds the given global element declaration to this Schema definition

  Parameters:
    `elementDecl` - the ElementDecl to add to this Schema
  Throws:
    `SchemaException`

### getElementDecl

    public ElementDecl getElementDecl(int fingerprint)

  Get the global element declaration with a given name

  Parameters:
    `fingerprint` - identifies the name of the element
  Returns:
    the element declaration, or null if not found.

### addNotation

    public void addNotation(Notation notation)
                     throws SchemaException

  Adds the given Notation declaration to this Schema defintion

  Parameters:
    `notation` - the Notation to add to this Schema
  Throws:
    `SchemaException`

### getNotation

    public Notation getNotation(int fingerprint)

  Get the notation with a given name

  Parameters:
    `fingerprint` - identifies the name of the notation
  Returns:
    the element notation, or null if not found.

### addSimpleType

    public void addSimpleType(SimpleTypeDefinition simpleType)
                       throws SchemaException

  Adds the given named SimpleType definition to this Schema. If another simpleType with the same name already exists, it is overwritten.

  Parameters:
    `simpleType` - the SimpleType to add to this Schema
  Throws:
    `SchemaException` - if the SimpleType does not have a name

### getNamePool

    public NamePool getNamePool()

  Get the NamePool used by this schema

### getSchemaLocation

    public java.lang.String getSchemaLocation()

  Returns the schemaLocation hint provided for this schema

  Returns:
    the schemaLocation hint provided for this schema

### addIdentityConstraint

    public void addIdentityConstraint(IdentityConstraint constraint)

  Add an identity constraint

### getIdentityConstraint

    public IdentityConstraint getIdentityConstraint(int fingerprint)

  Get the identity constraint whose name has a given fingerprint

  Returns:
    the identity constraint, or null if there is none with that name

### getTargetNamespace

    public java.lang.String getTargetNamespace()

  Returns the target namespace for this Schema, or "" if no namespace has been defined.

  Returns:
    the target namespace for this Schema, or "" if no namespace has been defined

### getVersion

    public java.lang.String getVersion()

  Returns the version information of the XML Schema definition represented by this Schema instance.

  Returns:
    the version information of the XML Schema definition, or null if no version information exists.

### setSchemaLocation

    public void setSchemaLocation(java.lang.String schemaLocation)

  Set the schemaLocation for this schema. This is useful when this schema has been imported by another schema

  Parameters:
    `schemaLocation` - the location hint for this Schema

### setTargetNamespace

    public void setTargetNamespace(java.lang.String targetNamespace)

  Sets the target namespace for this Schema

  Parameters:
    `targetNamespace` - the target namespace for this Schema
  See Also:
    § 2.7 XML Schema Part 1: Structures

### setVersion

    public void setVersion(java.lang.String version)

  Sets the version information for the XML Schema defintion represented by this Schema instance.

  Parameters:
    `version` - the version for this XML Schema defination.

### copyTo

    public void copyTo(PreparedSchema destination)
                throws SchemaException

  Copy the components of this schema to another schema

  Parameters:
    `destination` - the destination of the copy
  Throws:
    `SchemaException` - if there are name clashes between this schema and the destination schema

### validate

    public boolean validate(javax.xml.transform.ErrorListener errorListener)
                     throws SchemaException,
                            ValidationException

  Checks the validity of this Schema definition.

  Parameters:
    `errorListener` - an error handler to which all errors should be reported
  Throws:
    `SchemaException` - if the ErrorListener decides that an error is fatal
    `ValidationException`

### validateReference

    public SchemaComponent validateReference(ComponentReference ref)
                                      throws SchemaException

  Helper method to validate that a reference to a schema component can be resolved

  Throws:
    `SchemaException`

### newValidator

    public javax.xml.validation.Validator newValidator()

### newValidatorHandler

    public javax.xml.validation.ValidatorHandler newValidatorHandler()

### getErrorCount

    public int getErrorCount()

  Test whether errors have been reported

### error

    public void error(java.lang.String message,
                      javax.xml.transform.SourceLocator locator)
               throws SchemaException

  Report an error

  Throws:
    `SchemaException`

### merge

    public static PreparedSchema merge(PreparedSchema ps1,
                                       PreparedSchema ps2)
                                throws SchemaException

  Merge two PreparedSchemas into one, rejecting any components that are defined in both.

  Parameters:
    `ps1` - the first PreparedSchema
    `ps2` - the second PreparedSchema
  Returns:
    the merged PreparedSchema
  Throws:
    `SchemaException`

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