com.saxonica.schema
Class ModelGroupDefinition

java.lang.Object
  extended by com.saxonica.schema.SchemaStructure
      extended by com.saxonica.schema.ModelGroup
          extended by com.saxonica.schema.ModelGroupDefinition
All Implemented Interfaces:
SerializableSchemaComponent, Term, UserSchemaComponent, Serializable, SourceLocator, SchemaComponent

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.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.saxonica.schema.ModelGroup
contentModel, simplifiedContentModel
 
Fields inherited from interface net.sf.saxon.type.SchemaComponent
FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING
 
Constructor Summary
ModelGroupDefinition(EnterpriseConfiguration config, SourceLocator locator)
          Creates a new Model Group definition
 
Method Summary
 String getCompositorName()
          Get the name of the compositor used in this model group
 int getFingerprint()
           
 String getName()
          Returns the local part of the name of this named Group.
 int getNameCode()
           
 String getTargetNamespace()
          Returns the namespace URI of the name of this named Group.
 boolean isEmptiable()
          Determine if empty content is allowed
 boolean 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(Stack references, SchemaCompiler compiler)
          This method is called to look for cycles.
 void serialize(SchemaModelSerializer serializer)
          Serialize the schema component
 void setNameCode(int 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.schema.ModelGroup
addParticle, checkElements, compile, containsAll, containsElementWildcard, fixup, gatherAllPermittedElements, getContentModelSize, getElementParticleCardinality, getElementParticleType, getListOfParticles, getSimplifiedContentModel, getTerm, isEmpty, iterateParticles, markVulnerableSubParticles, setContentModel
 
Methods inherited from class com.saxonica.schema.SchemaStructure
elaborate, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, setConfiguration, setFixupStatus, 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 com.saxonica.schema.UserSchemaComponent
elaborate
 
Methods inherited from interface net.sf.saxon.type.SchemaComponent
getRedefinitionLevel, getValidationStatus
 

Constructor Detail

ModelGroupDefinition

public ModelGroupDefinition(EnterpriseConfiguration config,
                            SourceLocator locator)
Creates a new Model Group definition

Parameters:
config - the Configuration to which this Model Group definition belongs
locator - 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

getNameCode

public int getNameCode()

getFingerprint

public int getFingerprint()

setNameCode

public void setNameCode(int nameCode)

getName

public String getName()
Returns the local part of the name of this named Group.

Returns:
the local name of this named Group.

getTargetNamespace

public 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 UnresolvedReferenceException
Determine if empty content is allowed

Specified by:
isEmptiable in class ModelGroup
Returns:
true if the content model of the model group allows empty content
Throws:
UnresolvedReferenceException - 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 class ModelGroup
Parameters:
container - the particle that contains this model group definition
Returns:
true if this compositor is pointless

lookForCycles

public void lookForCycles(Stack references,
                          SchemaCompiler compiler)
                   throws SchemaException,
                          UnresolvedReferenceException
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 interface UserSchemaComponent
Overrides:
lookForCycles in class ModelGroup
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
UnresolvedReferenceException

validate

public boolean validate(SchemaCompiler compiler)
                 throws SchemaException
Checks the validity of this Model Group Definition.

Specified by:
validate in interface UserSchemaComponent
Overrides:
validate in class ModelGroup
Returns:
true when this Schema definition is valid, otherwise false.
Throws:
SchemaException

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 interface SerializableSchemaComponent
Overrides:
serialize in class ModelGroup
Parameters:
serializer - used to receive the serialized output
Throws:
XPathException - if serialization fails

getCompositorName

public String getCompositorName()
Description copied from class: ModelGroup
Get the name of the compositor used in this model group

Specified by:
getCompositorName in class ModelGroup
Returns:
one of "sequence", "choice", or "all"


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.