Package com.saxonica.ee.schema
Class AllModelGroup
- java.lang.Object
-
- com.saxonica.ee.schema.SchemaStructure
-
- com.saxonica.ee.schema.ModelGroup
-
- com.saxonica.ee.schema.AllModelGroup
-
- All Implemented Interfaces:
Term,UserSchemaComponent,javax.xml.transform.SourceLocator,Location,SchemaComponent,org.xml.sax.Locator
public class AllModelGroup extends ModelGroup
An AllModelGroup represents an xs:all element in the schema
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.sf.saxon.type.SchemaComponent
SchemaComponent.ValidationStatus
-
-
Field Summary
-
Fields inherited from class com.saxonica.ee.schema.ModelGroup
contentModel, simplifiedContentModel
-
Fields inherited from interface net.sf.saxon.type.SchemaComponent
COMPONENT_FUNCTION_TYPE
-
-
Constructor Summary
Constructors Constructor Description AllModelGroup()Create an AllModelGroup
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParticle(Particle particle)Adds a given Particle to the content model defined by this Compositorprotected static java.lang.StringallSubsumes(UserComplexType base, ComplexType sub, SchemaCompiler compiler)Test whether a complex type constructed using "all" subsumes another complex type.protected booleancheckElements(IntHashMap<ElementDecl> map, SchemaCompiler compiler)Check that the elements defined as particles in this compositor are consistent (overrides method on parent class ModelGroup)booleancontainsAll(boolean simplified)Determine if the content model uses xs:all.voidelaborate(SchemaCompiler compiler)Elaborate the schema component: after reloading a serialized schema component model, this expands the component with derived information needed during validation episodes.java.lang.StringgetCompositorName()Get the name of this compositorIntToIntMapgetCounterMap()Get a mapping from element name fingerprints (including fingerprints of substitution group members) to entries in the minima and maxima arrays.IntHashMapgetDeclarationMap()Get a mapping from element name fingerprints (including fingerprints of substitution group members) to local or global element declarations to be used to validate the content of each element in the all groupint[]getMaxima()Get the values of maxOccurs() for all the particles, as an arrayint[]getMinima()Get the values of minOccurs() for all the particles, as an arrayStructuredQName[]getNameCodes()Get the namecodes of the element particles corresponding to each item in the maxima/minima arrays.intgetNumberOfElementParticles()Get the number of element particlesjava.util.List<Particle>getSimplifiedContentModel()Remove pointless particles from this content model (recursively), and replace group references by the content of the identified groupjava.util.List<ElementWildcard>getWildcards()Get the list of element wildcards (XSDL 1.1 only)booleanisEmptiable()Determine if empty content is allowedbooleanisPointless(ModelGroup container)Test whether the compositor is pointless, as described in XML Schema Part 1 Schema Component Constraint: Particle Valid (Restriction)booleanvalidate(SchemaCompiler compiler)Checks the validity of this Compositor definition.-
Methods inherited from class com.saxonica.ee.schema.ModelGroup
compile, containsElementWildcard, fixup, gatherAllPermittedElements, getComponentAsFunction, getContentModelSize, getElementParticleCardinality, getElementParticleType, getParticles, getTerm, isEmpty, lookForCycles, markVulnerableSubParticles, serialize, setContentModel
-
Methods inherited from class com.saxonica.ee.schema.SchemaStructure
getColumnNumber, getConfiguration, getFixupStatus, getGeneratedId, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, hasSameLocation, isValidationNeeded, makeXPathExpressionPropertyRecord, saveLocation, setConfiguration, setFixupStatus, setGeneratedId, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.type.SchemaComponent
getRedefinitionLevel, getValidationStatus
-
-
-
-
Method Detail
-
addParticle
public void addParticle(Particle particle)
Adds a given Particle to the content model defined by this Compositor- Overrides:
addParticlein classModelGroup- Parameters:
particle- the Particle to be added
-
getNumberOfElementParticles
public int getNumberOfElementParticles()
Get the number of element particles- Returns:
- the number of element particles in the content model
-
containsAll
public boolean containsAll(boolean simplified)
Determine if the content model uses xs:all.- Overrides:
containsAllin classModelGroup- Parameters:
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 particles- Returns:
- true (always)
-
isEmptiable
public boolean isEmptiable() throws MissingComponentExceptionDetermine if empty content is allowed- Specified by:
isEmptiablein classModelGroup- Returns:
- true if this content model permits empty content
- Throws:
MissingComponentException- if the schema contains unresolved references to required components
-
isPointless
public boolean isPointless(ModelGroup container)
Test whether the compositor is pointless, as described in XML Schema Part 1 Schema Component Constraint: Particle Valid (Restriction)- Overrides:
isPointlessin classModelGroup- Parameters:
container- not used- Returns:
- true if the particle is pointless (which effectively means it can't match anything)
-
checkElements
protected boolean checkElements(IntHashMap<ElementDecl> map, SchemaCompiler compiler) throws SchemaException, MissingComponentException
Check that the elements defined as particles in this compositor are consistent (overrides method on parent class ModelGroup)- Overrides:
checkElementsin classModelGroup- Parameters:
map- a HashMap that maps integers to ElementDecl'scompiler- used for error reporting- Returns:
- true of the elements are consistent
- Throws:
SchemaException- if the schema is invalidMissingComponentException- if the schema contains unresolved references to required components
-
getCompositorName
public java.lang.String getCompositorName()
Get the name of this compositor- Specified by:
getCompositorNamein classModelGroup- Returns:
- one of "sequence", "choice", or "all"
-
getSimplifiedContentModel
public java.util.List<Particle> getSimplifiedContentModel() throws MissingComponentException
Remove pointless particles from this content model (recursively), and replace group references by the content of the identified group- Overrides:
getSimplifiedContentModelin classModelGroup- Returns:
- the simplified content model
- Throws:
MissingComponentException
-
validate
public boolean validate(SchemaCompiler compiler) throws SchemaException
Checks the validity of this Compositor definition.- Specified by:
validatein interfaceUserSchemaComponent- Overrides:
validatein classModelGroup- Returns:
- true when this Schema definition is valid, otherwise false.
- Throws:
SchemaException- when the error listener decides an error is fatal
-
elaborate
public void elaborate(SchemaCompiler compiler) throws SchemaException
Elaborate the schema component: after reloading a serialized schema component model, this expands the component with derived information needed during validation episodes. The model is assumed to be valid.- Specified by:
elaboratein interfaceUserSchemaComponent- Overrides:
elaboratein classSchemaStructure- Parameters:
compiler- the schema compiler- Throws:
SchemaException
-
getMaxima
public int[] getMaxima()
Get the values of maxOccurs() for all the particles, as an array- Returns:
- an array containing the maxOccurs() values. The value "unbounded" is represented as -1. The entry in the array for a given element name can be found using the counterMap.
-
getMinima
public int[] getMinima()
Get the values of minOccurs() for all the particles, as an array- Returns:
- an array containing the minOccurs() values. The entry in the array for a given element name can be found using the counterMap.
-
getNameCodes
public StructuredQName[] getNameCodes()
Get the namecodes of the element particles corresponding to each item in the maxima/minima arrays.- Returns:
- an array containing the nameCode values.
-
getCounterMap
public IntToIntMap getCounterMap()
Get a mapping from element name fingerprints (including fingerprints of substitution group members) to entries in the minima and maxima arrays. Note that this includes entries for all members of substitution groups, so several fingeprints map to the same counter position- Returns:
- a map from element fingerprints to counter positions
-
getDeclarationMap
public IntHashMap getDeclarationMap()
Get a mapping from element name fingerprints (including fingerprints of substitution group members) to local or global element declarations to be used to validate the content of each element in the all group- Returns:
- a map from element name fingerprints to element declarations
-
getWildcards
public java.util.List<ElementWildcard> getWildcards()
Get the list of element wildcards (XSDL 1.1 only)- Returns:
- a list holding the element wildcards defined in this model group, or an empty list if there are none
-
allSubsumes
protected static java.lang.String allSubsumes(UserComplexType base, ComplexType sub, SchemaCompiler compiler) throws SchemaException
Test whether a complex type constructed using "all" subsumes another complex type. This test is always done after simplification of the content model- Parameters:
base- the base type, which must be defined using xs:allsub- the type that is (supposedly) subsumed by the base typecompiler- used for reporting errors and warnings- Returns:
- null if the "all" particle subsumes the other; otherwise, a string explaining why not. If the string starts with "?", this means Saxon is unable to prove one way or the other whether the derived type is a valid restriction or not.
- Throws:
SchemaException- if the schema is not valid
-
-