public abstract class Particle extends SimpleComponentReference implements UserSchemaComponent
Modifier and Type | Field and Description |
---|---|
static int |
UNBOUNDED
A constant to represent an UNBOUNDED number of occurrences
|
symbolSpace, target
COMPONENT_FUNCTION_TYPE, FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING
Constructor and Description |
---|
Particle() |
Modifier and Type | Method and Description |
---|---|
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(HashSet<StructuredQName> result,
boolean ignoreWildcards)
Find the set of all element particles allowed within the content model of this particle, identified
by their integer fingerprints.
|
Function |
getComponentAsFunction()
Get the schema component in the form of a function item.
|
abstract int |
getElementParticleCardinality(StructuredQName elementName)
Find an element particle within this complex type definition having a given element name
(identified by elementName), 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(StructuredQName 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 to an XML Schema Component Model file
|
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.
|
getSymbolSpace, getTarget, getTargetComponentName, isDangling, isResolved, setTarget, setTargetComponentName, tryToResolve
elaborate, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, lookForCycles, makeXPathExpressionPropertyRecord, saveLocation, setConfiguration, setFixupStatus, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
elaborate, lookForCycles
getRedefinitionLevel, getValidationStatus
getConfiguration
getColumnNumber, getLineNumber, getPublicId, getSystemId, saveLocation
public static final int UNBOUNDED
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() throws MissingComponentException
MissingComponentException
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() throws MissingComponentException
MissingComponentException
public final boolean isVulnerable()
public static int computeParticleCardinality(int minOccurs, int maxOccurs)
minOccurs
- Minimum occurrencesmaxOccurs
- Maximum occurrences (-1 = unbounded)public abstract boolean containsElementWildcard() throws MissingComponentException
MissingComponentException
public abstract void gatherAllPermittedElements(HashSet<StructuredQName> result, boolean ignoreWildcards) throws SchemaException
result
- an initially-empty set in which the results are accumulatedignoreWildcards
- if true, wildcards are ignored. If false, the result will contain the name
XS_INVALID, meaning that it is not possible to enumerate
the elements that can appear in the content.SchemaException
- if an error is found in the schemapublic abstract int getElementParticleCardinality(StructuredQName elementName) throws MissingComponentException
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
.elementName
- Identifies the name of the child element within this content modelMissingComponentException
public abstract boolean isEmptiable() throws MissingComponentException
MissingComponentException
- if the schema contains an unresolved reference to a required componentpublic abstract SchemaType getElementParticleType(StructuredQName fingerprint) throws MissingComponentException
fingerprint
- Identifies the name of the child element within this content modelMissingComponentException
public abstract boolean fixup(SchemaCompiler compiler) throws SchemaException
fixup
in interface UserSchemaComponent
fixup
in class SchemaStructure
compiler
- is used for reporting errorsSchemaException
public abstract boolean validate(SchemaCompiler compiler) throws SchemaException
validate
in interface UserSchemaComponent
compiler
- the schema compilerSchemaException
- if an error is found and the
error listener decides that the error is fatalpublic abstract void compile(SchemaCompiler compiler) throws SchemaException
compiler
- the schema compilerSchemaException
- if a fatal error occurspublic abstract boolean isPointless(ModelGroup container) throws MissingComponentException
container
- the model group containing this particle; null if there is no containing model groupMissingComponentException
public abstract void serializeParticle(SchemaModelSerializer serializer) throws XPathException, MissingComponentException
serializer
- the object responsible for serializationXPathException
- if writing the serialized form to the destination failsMissingComponentException
- if the schema cannot be serialized because some components are missing.public Function getComponentAsFunction()
SchemaComponent
getComponentAsFunction
in interface SchemaComponent
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.