|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.saxonica.schema.SchemaStructure com.saxonica.schema.SimpleComponentReference com.saxonica.schema.Particle
public abstract class Particle
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, or a model group. To allow for content models that have not been fully resolved, we also allow a model group reference as a particle (that is, a reference to a named model group definition).
Field Summary | |
---|---|
static int |
UNBOUNDED
A constant to represent an UNBOUNDED number of occurrences |
Fields inherited from class com.saxonica.schema.SimpleComponentReference |
---|
nameCode, symbolSpace, target |
Fields inherited from interface net.sf.saxon.type.SchemaComponent |
---|
FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING |
Constructor Summary | |
---|---|
Particle()
|
Method Summary | |
---|---|
abstract void |
compile(SchemaCompiler compiler)
Compile a particle |
static int |
computeParticleCardinality(int minOccurs,
int maxOccurs)
Compute an XPath cardinality (e.g. |
abstract boolean |
containsElementWildcard()
Ask whether the particle contains an element wildcard |
abstract boolean |
fixup(SchemaCompiler compiler)
Check references from this component to other components |
abstract void |
gatherAllPermittedElements(IntHashSet result,
boolean ignoreWildcards)
Find the set of all element particles allowed within the content model of this particle, identified by their integer fingerprints. |
abstract 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. |
abstract SchemaType |
getElementParticleType(int fingerprint)
Find an element particle within this part of a content model 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 Particle may appear in the containing content model |
int |
getMinOccurs()
Returns the minimum number of occurrences that this Particle must appear in the containing content model |
abstract Term |
getTerm()
Get the term corresponding to this particle |
abstract boolean |
isEmptiable()
Determine if empty content is allowed |
abstract boolean |
isPointless(ModelGroup container)
Test whether the particle is pointless, as described in XML Schema Part 1 Schema Component Constraint: Particle Valid (Restriction) |
boolean |
isVulnerable()
Ask whether the particle is vulnerable. |
void |
markVulnerableSubParticles()
Mark the vulnerable subParticles of this particle |
abstract void |
serializeParticle(SchemaModelSerializer serializer)
Serialize this particle |
void |
setMaxOccurs(int maxOccurs)
Sets the maximum number of occurrences for this Particle within the containing content model |
void |
setMinOccurs(int minOccurs)
Sets the minimum number of occurrences for this Particle within the containing content model |
void |
setVulnerable(boolean vulnerable)
Mark the particle as being (or not being) vulnerable. |
abstract boolean |
validate(SchemaCompiler compiler)
Check the validity (consistency) of this element definition. |
Methods inherited from class com.saxonica.schema.SimpleComponentReference |
---|
getFingerprint, getNameCode, getSymbolSpace, getTarget, isResolved, setNameCode, setTarget, tryToResolve |
Methods inherited from class com.saxonica.schema.SchemaStructure |
---|
elaborate, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSystemId, getValidationStatus, lookForCycles, setConfiguration, setFixupStatus, setLineNumber, setLocator, setRedefinitionLevel, 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.UserSchemaComponent |
---|
elaborate, lookForCycles |
Methods inherited from interface net.sf.saxon.type.SchemaComponent |
---|
getRedefinitionLevel, getValidationStatus |
Methods inherited from interface com.saxonica.schema.ComponentReference |
---|
getConfiguration |
Methods inherited from interface javax.xml.transform.SourceLocator |
---|
getColumnNumber, getLineNumber, getPublicId, getSystemId |
Field Detail |
---|
public static int UNBOUNDED
Constructor Detail |
---|
public Particle()
Method Detail |
---|
public final int getMaxOccurs()
public final int getMinOccurs()
public final void setMaxOccurs(int maxOccurs)
maxOccurs
- the maximum number of occurrences for this Particle, or -1 to indicate
that the maximum is unboundedpublic final void setMinOccurs(int minOccurs)
minOccurs
- the minimum number of occurrences for this Particlepublic abstract Term getTerm()
public final void setVulnerable(boolean vulnerable)
vulnerable
- true if the particle is vulnerable.
A particle is vulnerable if (a) it is contained in a particle that allows repetition, and
(b) everything both before and after it in its enclosing particle
is optional, that is, the input it accepts may be all that its enclosing particle accepts.public void markVulnerableSubParticles()
public final boolean isVulnerable()
public static int computeParticleCardinality(int minOccurs, int maxOccurs)
minOccurs
- Minimum occurrencesmaxOccurs
- Maximum occurrences (-1 = unbounded)
public abstract boolean containsElementWildcard()
public abstract void gatherAllPermittedElements(IntHashSet result, boolean ignoreWildcards) throws SchemaException
result
- an initially-empty integer set in which the results are accumulatedignoreWildcards
- if true, wildcards are ignored. If false, the result will be
an integer set containing the value -1, meaning that it is not possible to enumerate
the elements that can appear in the content.
SchemaException
public abstract int getElementParticleCardinality(int fingerprint)
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 StaticProperty.ALLOWS_ZERO
.
fingerprint
- Identifies the name of the child element within this content model
public abstract boolean isEmptiable() throws UnresolvedReferenceException
UnresolvedReferenceException
public abstract SchemaType getElementParticleType(int fingerprint)
fingerprint
- Identifies the name of the child element within this content modelpublic abstract boolean fixup(SchemaCompiler compiler) throws SchemaException, UnresolvedReferenceException
fixup
in interface UserSchemaComponent
fixup
in class SchemaStructure
compiler
- is used for reporting errors
SchemaException
UnresolvedReferenceException
public abstract boolean validate(SchemaCompiler compiler) throws SchemaException
validate
in interface UserSchemaComponent
compiler
-
SchemaException
- if an error is found and the
error listener decides that the error is fatalpublic abstract void compile(SchemaCompiler compiler) throws SchemaException
compiler
-
SchemaException
public abstract boolean isPointless(ModelGroup container)
public abstract void serializeParticle(SchemaModelSerializer serializer) throws XPathException
XPathException
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |