com.saxonica.schema
Interface Particle

All Superinterfaces:
SchemaComponent, java.io.Serializable, UserSchemaComponent
All Known Implementing Classes:
AbstractParticle, ElementParticle, ElementWildcard

public interface Particle
extends UserSchemaComponent

Represents a Particle as defined by XML Schema. A particle is a component of a content model, consisting of a term and a permitted cardinality range. The term may be an element declaration, a wildcard, a sequence, a choice, or all.


Field Summary
 
Fields inherited from interface net.sf.saxon.type.SchemaComponent
FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING
 
Method Summary
 void compile(PreparedSchema schema, UserComplexType subjectType)
          Compile a particle
 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 getMaxOccurs()
          Returns the maximum number of occurrences that this CMParticle may appear
 int getMinOccurs()
          Returns the minimum number of occurrences that this Particle must appear
 Term getTerm()
          Returns the term contained by this particle
 boolean isEmptiable()
          Determine if empty content is allowed
 void rewrite()
          Rewrite a particle prior to compiling it
 void setMinOccurs(int minOccurs)
          Change the value of minOccurs.
 
Methods inherited from interface com.saxonica.schema.UserSchemaComponent
fixup, lookForCycles, validate
 
Methods inherited from interface net.sf.saxon.type.SchemaComponent
getValidationStatus
 

Method Detail

getMaxOccurs

public int getMaxOccurs()
Returns the maximum number of occurrences that this CMParticle may appear

Returns:
the maximum number of occurrences that this CMParticle may appear. A non positive (n < 1) value indicates that the value is unspecified (ie. unbounded).

getMinOccurs

public int getMinOccurs()
Returns the minimum number of occurrences that this Particle must appear

Returns:
the minimum number of occurrences that this Particle must appear A negative (n < 0) value indicates that the value is unspecified.

setMinOccurs

public void setMinOccurs(int minOccurs)
Change the value of minOccurs. Used while rewriting the branches of a choice


getTerm

public Term getTerm()
Returns the term contained by this particle


isEmptiable

public boolean isEmptiable()
                    throws UnresolvedReferenceException
Determine if empty content is allowed

Throws:
UnresolvedReferenceException

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.

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.

Parameters:
fingerprint - Identifies the name of the child element within this content model
Throws:
SchemaException
ValidationException

rewrite

public void rewrite()
Rewrite a particle prior to compiling it


compile

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

Parameters:
schema - used for error reporting purposes
subjectType - the complex type being compiled
Throws:
SchemaException
ValidationException