Package com.saxonica.ee.schema
Class ModelGroupDefinition
- java.lang.Object
-
- com.saxonica.ee.schema.SchemaStructure
-
- com.saxonica.ee.schema.ModelGroup
-
- com.saxonica.ee.schema.ModelGroupDefinition
-
- All Implemented Interfaces:
SerializableSchemaComponent
,Term
,UserSchemaComponent
,javax.xml.transform.SourceLocator
,Location
,SchemaComponent
,org.xml.sax.Locator
public class ModelGroupDefinition extends ModelGroup implements SerializableSchemaComponent
A Model Group Definition: a schema component corresponding to a top-level (named) xs:group element in a schema document.
-
-
Field Summary
-
Fields inherited from class com.saxonica.ee.schema.ModelGroup
contentModel, simplifiedContentModel
-
-
Constructor Summary
Constructors Constructor Description ModelGroupDefinition(EnterpriseConfiguration config, javax.xml.transform.SourceLocator locator)
Creates a new Model Group definition
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Function
getComponentAsFunction()
Get the schema component in the form of a function item.java.lang.String
getCompositorName()
Get the name of the compositor used in this model groupStructuredQName
getModelGroupName()
java.lang.String
getName()
Returns the local part of the name of this named Group.java.lang.String
getTargetNamespace()
Returns the namespace URI of the name of this named Group.boolean
isEmptiable()
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
isSameGroup(ModelGroupDefinition other)
Test whether this is the same group as another group.void
lookForCycles(java.util.Stack<SchemaComponent> references, SchemaCompiler compiler)
This method is called to look for cycles.void
serialize(SchemaModelSerializer serializer)
Serialize the schema componentvoid
setModelGroupName(StructuredQName nameCode)
void
setRedefinedModelGroupDefinition(ModelGroupDefinition other)
Set the model group definition that this one redefines.boolean
validate(SchemaCompiler compiler)
Checks the validity of this Model Group Definition.-
Methods inherited from class com.saxonica.ee.schema.ModelGroup
addParticle, checkElements, compile, containsAll, containsElementWildcard, fixup, gatherAllPermittedElements, getContentModelSize, getElementParticleCardinality, getElementParticleType, getParticles, getSimplifiedContentModel, getTerm, isEmpty, markVulnerableSubParticles, setContentModel
-
Methods inherited from class com.saxonica.ee.schema.SchemaStructure
elaborate, 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
-
Methods inherited from interface com.saxonica.ee.schema.UserSchemaComponent
elaborate
-
-
-
-
Constructor Detail
-
ModelGroupDefinition
public ModelGroupDefinition(EnterpriseConfiguration config, javax.xml.transform.SourceLocator locator)
Creates a new Model Group definition- Parameters:
config
- the Configuration to which this Model Group definition belongslocator
- the source location of the model group definition
-
-
Method Detail
-
setRedefinedModelGroupDefinition
public void setRedefinedModelGroupDefinition(ModelGroupDefinition other)
Set the model group definition that this one redefines. Only set if this is a redefining model group that does not contain a self-reference; in this case validate() must check that it is a valid refinement- Parameters:
other
- the model group that this one redefines
-
setModelGroupName
public void setModelGroupName(StructuredQName nameCode)
-
getModelGroupName
public StructuredQName getModelGroupName()
-
getName
public java.lang.String getName()
Returns the local part of the name of this named Group.- Returns:
- the local name of this named Group.
-
getTargetNamespace
public java.lang.String getTargetNamespace()
Returns the namespace URI of the name of this named Group.- Returns:
- the namespace URI of this named Group: null if the group is in no namespace
-
isEmptiable
public boolean isEmptiable() throws MissingComponentException
Determine if empty content is allowed- Specified by:
isEmptiable
in classModelGroup
- Returns:
- true if the content model of the model group allows 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:
isPointless
in classModelGroup
- Parameters:
container
- the particle that contains this model group definition- Returns:
- true if this compositor is pointless
-
lookForCycles
public void lookForCycles(java.util.Stack<SchemaComponent> references, SchemaCompiler compiler) throws SchemaException
This method is called to look for cycles. The object implementing this method is required (a) to raise an exception if the object itself appears in the list of references, (b) to add itself to the list of references, and (c) to call the lookForCycles method on all the objects that it references.- Specified by:
lookForCycles
in interfaceUserSchemaComponent
- Overrides:
lookForCycles
in classModelGroup
- Parameters:
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 reporting- Throws:
SchemaException
- if cycles are found
-
validate
public boolean validate(SchemaCompiler compiler) throws SchemaException
Checks the validity of this Model Group 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
- if the declaration is invalid
-
isSameGroup
public boolean isSameGroup(ModelGroupDefinition other)
Test whether this is the same group as another group. They are considered to be the same type if they are derived from the same type definition in the original XML representation (which can happen when there are multiple includes of the same file)- Parameters:
other
- the other group- Returns:
- true if the groups are the same
-
serialize
public void serialize(SchemaModelSerializer serializer) throws XPathException
Serialize the schema component- Specified by:
serialize
in interfaceSerializableSchemaComponent
- Overrides:
serialize
in classModelGroup
- Parameters:
serializer
- used to receive the serialized output- Throws:
XPathException
- if serialization fails
-
getCompositorName
public java.lang.String getCompositorName()
Description copied from class:ModelGroup
Get the name of the compositor used in this model group- Specified by:
getCompositorName
in classModelGroup
- Returns:
- one of "sequence", "choice", or "all"
-
getComponentAsFunction
public Function getComponentAsFunction()
Description copied from interface:SchemaComponent
Get the schema component in the form of a function item. This allows schema information to be made visible to XSLT or XQuery code. The function makes available the contents of the schema component as defined in the XSD specification. The function takes a string as argument representing a property name, and returns the corresponding property of the schema component. There is also a property "class" which returns the kind of schema component, for example "Attribute Declaration".- Specified by:
getComponentAsFunction
in interfaceSchemaComponent
- Overrides:
getComponentAsFunction
in classModelGroup
- Returns:
- the schema component represented as a function from property names to property values.
-
-