com.saxonica.schema
Interface Particle

All Superinterfaces:
SchemaComponent, Serializable, SerializableSchemaComponent, UserSchemaComponent
All Known Implementing Classes:
AbstractParticle, AllCompositor, ChoiceCompositor, Compositor, ElementParticle, ElementWildcard, GroupReference, ModelGroupDefinition, SequenceCompositor

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
 
Fields inherited from interface com.saxonica.schema.SerializableSchemaComponent
ALL_COMPOSITOR, ATOMIC_TYPE, ATTRIBUTE_DECL, ATTRIBUTE_GROUP, ATTRIBUTE_GROUP_REF, ATTRIBUTE_USE, ATTRIBUTE_WILDCARD, CHOICE_COMPOSITOR, COMPLEX_TYPE, ELEMENT_DECL, ELEMENT_PARTICLE, ELEMENT_WILDCARD, FACET, KEY, KEYREF, LIST_TYPE, MODEL_GROUP, MODEL_GROUP_REF, NOTATION, SEQUENCE_COMPOSITOR, UNION_TYPE, UNIQUE
 
Method Summary
 void compile(SchemaCompiler compiler)
          Compile a particle
 void gatherAllPermittedElements(IntHashSet result)
          Find the set of all element particles allowed within the content model of this particle, identified by their integer fingerprints.
 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
 boolean isPointless(Particle container)
          Test whether the particle is pointless, as described in XML Schema Part 1 Schema Component Constraint: Particle Valid (Restriction)
 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
 
Methods inherited from interface com.saxonica.schema.SerializableSchemaComponent
getComponentTypeCode, serialize
 

Method Detail

getMaxOccurs

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

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

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


getTerm

Term getTerm()
Returns the term contained by this particle


isEmptiable

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

Throws:
UnresolvedReferenceException

getElementParticleType

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

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

gatherAllPermittedElements

void gatherAllPermittedElements(IntHashSet result)
                                throws SchemaException,
                                       ValidationException
Find the set of all element particles allowed within the content model of this particle, identified by their integer fingerprints. Ignore wildcards.

Parameters:
result - an initially-empty integer set in which the results are accumulated
Throws:
SchemaException
ValidationException

compile

void compile(SchemaCompiler compiler)
             throws SchemaException,
                    ValidationException
Compile a particle

Parameters:
compiler -
Throws:
SchemaException
ValidationException

isPointless

boolean isPointless(Particle container)
Test whether the particle is pointless, as described in XML Schema Part 1 Schema Component Constraint: Particle Valid (Restriction)



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