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 GroupReference

    java.lang.Object
      com.saxonica.schema.SchemaStructure
          com.saxonica.schema.AbstractParticle
              com.saxonica.schema.GroupReference

All Implemented Interfaces:
  ComponentReference, Particle, SchemaComponent, java.io.Serializable, javax.xml.transform.SourceLocator, UserSchemaComponent

public class GroupReference
extends AbstractParticle
implements ComponentReference, UserSchemaComponent

A reference within the content model of a complex type to a Model Group Definition. Corresponds to a non-top-level xs:group element in a schema document, that is, an xs:group element with a ref attribute.

There is no direct equivalent of a GroupReference in the W3C schema component model, because in that model the structure of a complex type is always fully expanded: that is, any group references are replaced by the content of the group they refer to. This model retains group references to allow late binding and redefinition. However, methods are provided on the `Compositor` class to give a view of the content model in which the group references disappear.

See Also:
  Serialized Form

Field Summary

Fields inherited from class com.saxonica.schema.AbstractParticle
`UNBOUNDED`

Fields inherited from interface net.sf.saxon.type.SchemaComponent
`FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING`

Constructor Summary
`GroupReference(PreparedSchema schema, javax.xml.transform.SourceLocator locator)` Creates a new Group definition

Method Summary
`void` | `compile(PreparedSchema schema, UserComplexType subjectType)` Compile a particle
`boolean` | `fixup(PreparedSchema schema)` Fix up references to other elements in the schema.
`int` | `getElementParticleCardinality(int fingerprint)` Find an element particle within this complex type definition having a given element name (identified by fingerprint), and return the cardinality associated with that element particle, that is, the number of times the element can occur within this complex type.
`SchemaType` | `getElementParticleType(int fingerprint)` Find an element particle within this complex type definition having a given element name (identified by fingerprint), and return the schema type associated with that element particle.
`int` | `getFingerprint()` Get the fingerprint of the target of this reference
`ModelGroupDefinition` | `getGroup()`
`int` | `getSymbolSpace()` Get the symbol space of the target of this reference
`SchemaComponent` | `getTarget()` Returns the group that this group object is a reference to.
`Term` | `getTerm()` Get the term corresponding to this particle
`boolean` | `isEmptiable()` Determine if empty content is allowed
`boolean` | `isResolved()` Determine whether this reference has been resolved
`void` | `lookForCycles(PreparedSchema schema, java.util.Stack references)` This method is called to look for cycles.
`void` | `setFingerprint(int fingerprint)`
`void` | `tryToResolve(PreparedSchema schema)` Attempt to resolved this reference using the groups defined in a given schema.
`boolean` | `validate(PreparedSchema schema)` Checks the validity of this Schema definition.

Methods inherited from class com.saxonica.schema.AbstractParticle
`getMaxOccurs, getMinOccurs, rewrite, setMaxOccurs, setMinOccurs`

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

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

Methods inherited from interface com.saxonica.schema.ComponentReference
`getSchema`

Methods inherited from interface javax.xml.transform.SourceLocator
`getColumnNumber, getLineNumber, getPublicId, getSystemId`

Methods inherited from interface net.sf.saxon.type.SchemaComponent
`getValidationStatus`

Constructor Detail

### GroupReference

    public GroupReference(PreparedSchema schema,
                          javax.xml.transform.SourceLocator locator)

  Creates a new Group definition

Parameters:
  `schema` - the XML Schema to which this Group belongs

Method Detail

### isResolved

    public boolean isResolved()

  Determine whether this reference has been resolved

  Specified by:
    `isResolved` in interface `ComponentReference`

### getGroup

    public ModelGroupDefinition getGroup()
                                  throws UnresolvedReferenceException

  Throws:
    `UnresolvedReferenceException`

### setFingerprint

    public void setFingerprint(int fingerprint)

### getFingerprint

    public int getFingerprint()

  Description copied from interface: `ComponentReference`
  Get the fingerprint of the target of this reference

  Specified by:
    `getFingerprint` in interface `ComponentReference`

### getSymbolSpace

    public int getSymbolSpace()

  Get the symbol space of the target of this reference

  Specified by:
    `getSymbolSpace` in interface `ComponentReference`

### isEmptiable

    public boolean isEmptiable()
                        throws UnresolvedReferenceException

  Determine if empty content is allowed

  Specified by:
    `isEmptiable` in interface `Particle`
  Throws:
    `UnresolvedReferenceException`

### fixup

    public boolean fixup(PreparedSchema schema)
                  throws SchemaException

  Fix up references to other elements in the schema.

  Specified by:
    `fixup` in interface `UserSchemaComponent`
  Parameters:
    `schema` - The schema.
  Returns:
    true
  Throws:
    `SchemaException`

### lookForCycles

    public void lookForCycles(PreparedSchema schema,
                              java.util.Stack references)
                       throws SchemaException,
                              UnresolvedReferenceException

  This method is called to look for cycles. The object implementing this method is required (a) to raise an exception if the object itself appears in the list of references, (b) to add itself to the list of references, and (c) to call the lookForCycles method on all the objects that it references.

  Specified by:
    `lookForCycles` in interface `UserSchemaComponent`
  Overrides:
    `lookForCycles` in class `SchemaStructure`
  Parameters:
    `schema` -
    `references` - A list of objects that contain direct or indirect references to this object, and that must therefore not be referred to from this object.
  Throws:
    `SchemaException`
    `UnresolvedReferenceException`

### getTarget

    public SchemaComponent getTarget()
                              throws UnresolvedReferenceException

  Returns the group that this group object is a reference to. Note this method doesn't bind irrevocably to the target group declaration, because this may change following a redefine.

  Specified by:
    `getTarget` in interface `ComponentReference`
  Returns:
    the schema component if the reference has been resolved.
  Throws:
    `UnresolvedReferenceException` - if the reference has not been resolved. Note that this is an unchecked exception.

### tryToResolve

    public void tryToResolve(PreparedSchema schema)

  Attempt to resolved this reference using the groups defined in a given schema. No error results if the reference cannot be resolved.

  Specified by:
    `tryToResolve` in interface `ComponentReference`
  Parameters:
    `schema` - The schema containing the candidate target components for the reference. If null, the schema containing the reference is used.

### getElementParticleType

    public SchemaType getElementParticleType(int fingerprint)

  Find an element particle within this complex type definition having a given element name (identified by fingerprint), and return the schema type associated with that element particle. If there is no such particle, return null. If the fingerprint matches an element wildcard, return the type of the global element declaration with the given name if one exists, or AnyType if none exists and lax validation is permitted by the wildcard.

  Specified by:
    `getElementParticleType` in interface `Particle`
  Parameters:
    `fingerprint` - Identifies the name of the child element within this content model

### getElementParticleCardinality

    public int getElementParticleCardinality(int fingerprint)
                                      throws SchemaException,
                                             ValidationException

  Find an element particle within this complex type definition having a given element name (identified by fingerprint), and return the cardinality associated with that element particle, that is, the number of times the element can occur within this complex type. The value is one of `StaticProperty.EXACTLY_ONE`, `StaticProperty.ALLOWS_ZERO_OR_ONE`, `StaticProperty.ALLOWS_ZERO_OR_MORE`, `StaticProperty.ALLOWS_ONE_OR_MORE`, If there is no such particle, return zero.

  Specified by:
    `getElementParticleCardinality` in interface `Particle`
  Parameters:
    `fingerprint` - Identifies the name of the child element within this content model
  Throws:
    `SchemaException`
    `ValidationException`

### validate

    public boolean validate(PreparedSchema schema)
                     throws SchemaException,
                            ValidationException

  Checks the validity of this Schema definition.

  Specified by:
    `validate` in interface `UserSchemaComponent`
  Parameters:
    `schema` - if this is not null, any errors that are detected should be reported using the error() method of this schema.
  Returns:
    true when this Schema definition is valid, otherwise false.
  Throws:
    `SchemaException`
    `ValidationException`

### compile

    public void compile(PreparedSchema schema,
                        UserComplexType subjectType)
                 throws SchemaException,
                        ValidationException

  Compile a particle

  Specified by:
    `compile` in interface `Particle`
  Parameters:
    `schema` - used for error reporting purposes
    `subjectType` - the complex type being compiled
  Throws:
    `SchemaException`
    `ValidationException`

### getTerm

    public Term getTerm()

  Get the term corresponding to this particle

  Specified by:
    `getTerm` in interface `Particle`
  Specified by:
    `getTerm` in class `AbstractParticle`
  Returns:
    the corresponding term

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