public abstract class ModelGroup extends SchemaStructure implements UserSchemaComponent, Term
ModelGroupDefinition
.SchemaComponent.ValidationStatus
Modifier and Type | Field and Description |
---|---|
protected java.util.List<Particle> |
contentModel
The list of particles making up the content model of this ModelGroup.
|
protected java.util.List<Particle> |
simplifiedContentModel
The reduced list of particles.
|
COMPONENT_FUNCTION_TYPE
Constructor and Description |
---|
ModelGroup()
Creates a new ModelGroup, with no name
|
Modifier and Type | Method and Description |
---|---|
void |
addParticle(Particle particle)
Adds a given Particle to the content model defined by this model group
|
protected boolean |
checkElements(IntHashMap<ElementDecl> map,
SchemaCompiler compiler)
Check that the elements defined as particles in this model group are consistent
|
void |
compile(SchemaCompiler compiler)
Compile this Compositor by compiling each of the particles contained in its
content model.
|
boolean |
containsAll(boolean simplified)
Test whether this model group contains an xs:all compositor
|
boolean |
containsElementWildcard()
Ask whether the model group contains an element wildcard
|
boolean |
fixup(SchemaCompiler compiler)
Check references from this component to other components
|
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.
|
Function |
getComponentAsFunction()
Get the schema component in the form of a function item.
|
abstract java.lang.String |
getCompositorName()
Get the name of the compositor used in this model group
|
int |
getContentModelSize()
Get the number of particles in the (unsimplified) content model
|
int |
getElementParticleCardinality(int 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.
|
SchemaType |
getElementParticleType(int elementName)
Find an element particle within this complex type definition having a given element name
(identified by elementName), and return the schema type associated with that element particle.
|
java.util.List<Particle> |
getParticles()
Get the (unsimplified list of) Particles of the content model defined by this model group.
|
java.util.List<Particle> |
getSimplifiedContentModel()
Remove pointless particles from this content model (recursively),
and replace group references by the content of the identified group
|
Term |
getTerm()
Get the term corresponding to this particle
|
abstract boolean |
isEmptiable()
Determine if empty content is allowed
|
boolean |
isEmpty()
Return true if the content model is empty
|
boolean |
isPointless(ModelGroup container)
Test whether the particle is pointless, as described in XML Schema Part 1
Schema Component Constraint: Particle Valid (Restriction)
|
void |
lookForCycles(java.util.Stack references,
SchemaCompiler compiler)
This method is called to look for cycles.
|
void |
markVulnerableSubParticles(boolean isRepeatable)
Mark contained particles as vulnerable.
|
void |
serialize(SchemaModelSerializer serializer)
Serialize the schema component
|
void |
setContentModel(java.util.List<Particle> particles)
Set the entire content model
|
boolean |
validate(SchemaCompiler compiler)
Checks the validity of this model group.
|
elaborate, getColumnNumber, getConfiguration, getFixupStatus, getGeneratedId, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, hasSameLocation, isValidationNeeded, makeXPathExpressionPropertyRecord, saveLocation, setConfiguration, setFixupStatus, setGeneratedId, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
elaborate
getRedefinitionLevel, getValidationStatus
protected java.util.List<Particle> contentModel
protected java.util.List<Particle> simplifiedContentModel
public abstract java.lang.String getCompositorName()
public void addParticle(Particle particle)
particle
- the Particle to be added. Note that the particle is ignored
(and is not added to the content model) if it has minOccurs=maxOccurs=0.public void setContentModel(java.util.List<Particle> particles)
particles
- a List whose members are Particle objectspublic abstract boolean isEmptiable() throws MissingComponentException
MissingComponentException
- if the schema contains
unresolved references to required componentspublic boolean isPointless(ModelGroup container) throws MissingComponentException
container
- not usedMissingComponentException
public java.util.List<Particle> getParticles()
public int getContentModelSize()
public boolean isEmpty()
public boolean containsAll(boolean simplified) throws MissingComponentException
simplified
- set to false if we want to look at the original unsimplified
content model, to true if we want the model after removing pointless particlesMissingComponentException
- if the schema contains unresolved
references to required componentspublic java.util.List<Particle> getSimplifiedContentModel() throws MissingComponentException
MissingComponentException
public void markVulnerableSubParticles(boolean isRepeatable) throws MissingComponentException
isRepeatable
- true if this particle repeats within the content modelMissingComponentException
public void lookForCycles(java.util.Stack references, SchemaCompiler compiler) throws SchemaException
lookForCycles
in interface UserSchemaComponent
lookForCycles
in class SchemaStructure
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.compiler
- used for error reportingSchemaException
public boolean validate(SchemaCompiler compiler) throws SchemaException
validate
in interface UserSchemaComponent
SchemaException
- when the error listener decides an error is fatalprotected boolean checkElements(IntHashMap<ElementDecl> map, SchemaCompiler compiler) throws SchemaException, MissingComponentException
map
- a HashMap that maps integers to ElementDecl'scompiler
- used for error reportingSchemaException
- if the schema is invalidMissingComponentException
- if the schema contains unresolved references
to required componentspublic SchemaType getElementParticleType(int elementName) throws MissingComponentException
elementName
- Identifies the name of the child element within this content modelMissingComponentException
public int getElementParticleCardinality(int 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.EMPTY
.elementName
- Identifies the name of the child element within this content modelMissingComponentException
public boolean containsElementWildcard() throws MissingComponentException
MissingComponentException
public 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 XS_INVALID_NAME, meaning that it is not possible to enumerate
the elements that can appear in the content.SchemaException
- if the schema is found to be invalidpublic void compile(SchemaCompiler compiler) throws SchemaException
compiler
- used for error reportingSchemaException
- if compilation fails.public boolean fixup(SchemaCompiler compiler) throws SchemaException, MissingComponentException
fixup
in interface UserSchemaComponent
fixup
in class SchemaStructure
compiler
- is used for reporting errorsSchemaException
MissingComponentException
public Term getTerm()
public void serialize(SchemaModelSerializer serializer) throws XPathException, MissingComponentException
serializer
- used to receive the serialized outputXPathException
- if serialization failsMissingComponentException
public Function getComponentAsFunction()
SchemaComponent
getComponentAsFunction
in interface SchemaComponent
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.