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
,SourceLocator
,Location
,SchemaComponent
,Locator
An AllModelGroup represents an xs:all element in the schema
-
Field Summary
Fields inherited from class com.saxonica.ee.schema.ModelGroup
contentModel, simplifiedContentModel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addParticle
(Particle particle) Adds a given Particle to the content model defined by this Compositorprotected static String
allSubsumes
(UserComplexType base, ComplexType sub, SchemaCompiler compiler) Test whether a complex type constructed using "all" subsumes another complex type.protected boolean
checkElements
(IntHashMap<ElementDecl> map, SchemaCompiler compiler) Check that the elements defined as particles in this compositor are consistent (overrides method on parent class ModelGroup)boolean
containsAll
(boolean simplified) Determine if the content model uses xs:all.void
elaborate
(SchemaCompiler compiler) Elaborate the schema component: after reloading a serialized schema component model, this expands the component with derived information needed during validation episodes.Get the name of this compositorGet a mapping from element name fingerprints (including fingerprints of substitution group members) to entries in the minima and maxima arrays.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[]
Get the values of maxOccurs() for all the particles, as an arrayint[]
Get the values of minOccurs() for all the particles, as an arrayGet the namecodes of the element particles corresponding to each item in the maxima/minima arrays.int
Get the number of element particlesRemove pointless particles from this content model (recursively), and replace group references by the content of the identified groupGet the list of element wildcards (XSDL 1.1 only)boolean
Determine if empty content is allowedboolean
isPointless
(ModelGroup container) Test whether the compositor is pointless, as described in XML Schema Part 1 Schema Component Constraint: Particle Valid (Restriction)boolean
validate
(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
-
Constructor Details
-
AllModelGroup
public AllModelGroup()Create an AllModelGroup
-
-
Method Details
-
addParticle
Adds a given Particle to the content model defined by this Compositor- Overrides:
addParticle
in 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:
containsAll
in 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
Determine if empty content is allowed- Specified by:
isEmptiable
in classModelGroup
- Returns:
- true if this content model permits empty content
- Throws:
MissingComponentException
- if the schema contains unresolved references to required components
-
isPointless
Test whether the compositor is pointless, as described in XML Schema Part 1 Schema Component Constraint: Particle Valid (Restriction)- Overrides:
isPointless
in 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:
checkElements
in 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
Get the name of this compositor- Specified by:
getCompositorName
in classModelGroup
- Returns:
- one of "sequence", "choice", or "all"
-
getSimplifiedContentModel
Remove pointless particles from this content model (recursively), and replace group references by the content of the identified group- Overrides:
getSimplifiedContentModel
in classModelGroup
- Returns:
- the simplified content model
- Throws:
MissingComponentException
-
validate
Checks the validity of this Compositor definition.- Specified by:
validate
in interfaceUserSchemaComponent
- Overrides:
validate
in classModelGroup
- Parameters:
compiler
- the schema compiler- Returns:
- true when this Schema definition is valid, otherwise false.
- Throws:
SchemaException
- when the error listener decides an error is fatal
-
elaborate
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:
elaborate
in interfaceUserSchemaComponent
- Overrides:
elaborate
in 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
Get the namecodes of the element particles corresponding to each item in the maxima/minima arrays.- Returns:
- an array containing the nameCode values.
-
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
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
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 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
-