## Package com.saxonica.schema

The Schema Object Model package contains classes used to represent the information in a schema.

See:
Description

Interface Summary
ComponentReference: A reference to a schema component.
Selection: A selection represents the restricted form of path expression permitted in XML Schema (both the selector and field variants)
SerializableSchemaComponent: A component that can be serialized by the SchemaSerializer.
Term: Represents a Term in a content model as defined by XML Schema.
UserSchemaComponent: A SchemaComponent is an object in a schema.

Class Summary
AllModelGroup: An AllModelGroup represents an xs:all element in the schema
Assertion: An Assertion schema component (See XML Schema 1.1 Part 1 Working Draft)
AssertionFacet: Represents an assertion facet on a schema-defined simple type.
AttributeDecl: An XML Schema Attribute Declaration.
AttributeGroupDecl: An XML Schema Attribute Group Declaration.
AttributeGroupReference: An XML Schema Attribute Group Reference, corresponding to an xs:attributeGroup element with a 'ref' attribute.
AttributeUse: An XML Schema Attribute Use: that is, a reference to an attribute declaration from within a complex type or attribute group.
AttributeWildcard: This class represents an xs:anyAttribute element in the schema.
ChoiceModelGroup: A ChoiceCompositor represents an xs:choice element in the schema
DigitsFacet: Represents either of the facets totalDigits or fractionDigits
ElementDecl: The object represents an element declaration in the schema.
ElementParticle: A reference to an element declaration within the content model of a complex type.
ElementWildcard: This class represents an <any> element in the schema.
EnumerationFacet: Represents a single enumeration facet defined on a simple type.
EnumerationFacetSet: Represents the set of enumeration values defined on a single simple type, This is a "virtual" facet that combines all the enumeration facets in one simple type definition.
Facet: Represents an XML Schema Facet.
IdentityConstraint: The base class for the XML Schema Identity Constraints (key, keyref, unique).
IdentityField: The field selector for an IdentityConstraint
IdentitySelector: The selector of an IdentityConstraint
Key: A class that represents the XML Schema Identity Constraint: Key.
KeyRef: This class represents an xs:keyRef identity constraint in a schema
LengthFacet: Represents the length facet.
MaxLengthFacet: Represents the minLength facet
MinLengthFacet: Represents the minLength facet
ModelGroup: An XML Schema Model Group.
ModelGroupDefinition: A Model Group Definition: a schema component corresponding to a top-level (named) xs:group element in a schema document.
ModelGroupParticle: A reference within the content model of a complex type to a Model Group Definition.
Notation: A Notation Declaration Schema Component
Particle: Represents a Particle as defined by XML Schema.
PathSelection: A PathSelection is a Selection that applies a NodeTest to each element between the context element and the node being tested, and returns true if they all match.
PatternFacet: Represents a pattern facet on a schema-defined simple type
PreparedSchema: A schema is a collection of schema components.
SchemaCompiler: A SchemaCompiler is capable of reading source schema documents and converting them into collections of schema components.
SchemaModelLoader: This class allows a schema model that was serialized using the `SchemaModelSerializer` to be loaded into memory.
SchemaModelSerializer: This class provides services enabling a compiled schema to be serialized to disk
SchemaStructure: The base class for all XML Schema stuctures.
SequenceModelGroup: A SequenceCompositor represents an xs:sequence element in the schema
SimpleComponentReference: A reference to a named schema group within the content model of a complex type
SingleNamespaceSchema: A schema (collection of schema components) that has an identifiable target namespace: typically the set of components derived from a single import or include.
SymbolSpace: This class holds constants used to identify the various symbol spaces defined in XML Schema: element declarations, attribute declarations, types, groups, and so on.
TypeAlternative: A TypeAlternative schema component (See XML Schema 1.1 Part 1 Working Draft)
TypeReference: A reference to a simple or complex type
UnionSelection: A union selection is a selection consisting of several alternatives separated by "|"
Unique: This class represents an xs:unique identity constraint
UserAtomicType: An object belonging to this class represents an atomic type: either a built-in atomic type, or a user-defined atomic type.
UserComplexType: A user-defined complex type (that is, any complex type other than xs:anyType)
UserDefinedType: This class represents a user-defined simple type or complex type as defined in XML Schema.
UserListType: Represents a SimpleType that is a list of a given SimpleType, known as its itemType.
UserSimpleType: This class represents a used-defined simple type, as defined in the XML Schema specification.
UserUnionType: A class that represents the XML Schema Union simple-type.
ValueRangeFacet: Represents any of the facets minInclusive, maxInclusive, minExclusive, maxExclusive
WhitespaceFacet: Represents a whitespace facet on a schema-defined simple type
Wildcard: A class that represents an XML Schema Wildcard.

Exception Summary
UnresolvedReferenceExceptionImpl: This exception occurs when an attempt is made to dereference a reference from one schema component to another, if the target of the reference cannot be found.

## Package com.saxonica.schema Description

The Schema Object Model package contains classes used to represent the information in a schema.

The code is derived from Castor, heavily modified (though retaining much of the original design). The classes representing objects in the schema are constructed using the corresponding classes in the Schema Importer package.

Representing the schema itself is the class `PreparedSchema`. All the schemas that have been imported into the application are linked from the `Configuration` object; they thus outlive a single transformation or query. Other important classes have intuitive names, for example ComplexType, SimpleType, ElementDecl, and AttributeDecl.

The schema class obtained by the Configuration.getSuperSchema() method represents the collection of all loaded schemas. There can only be one active collection of schema components for any one namespace. This means it is not possible to use two unrelated no-namespace schemas concurrently, or two different versions of a schema for the same namespace.

Named types, element declarations, and attribute declarations are indexed directly from the NamePool. It is not necessary first to locate the schema in which they are contained, they can be found directly using the namePool fingerprint of their expanded QName.

The schema model retains nearly all the information in the source schema: the notable omission is annotations.

The API for this package is particular to Saxon. At some time in the future it is possible that it may be replaced by an API conforming to externally-defined standards.

In the original Castor version of this code, the schema object model was designed for use by arbitrary client applications. It therefore provided methods to remove objects as well as to create them, it validated all arguments, and it allowed multithreaded updates. The version of the code in Saxon is designed to allow creation of a schema only by direct use of the class `SchemaReader`. Unused methods for removing and renaming objects have therefore been deleted, and validation already performed by the importer classes is not repeated. Validation is done in the importer classes wherever possible because this gives better diagnostics and error recovery.

Copyright (c) Saxonica Limited. All rights reserved.