com.saxonica.schema

## Class ModelGroupDefinition

- java.lang.Object
- - com.saxonica.schema.SchemaStructure
  - - com.saxonica.schema.ModelGroup
    - - 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

      `COMPONENT_FUNCTION_TYPE, FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ModelGroupDefinition(EnterpriseConfiguration config, SourceLocator locator)` Creates a new Model Group definition

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `FunctionItem` | `getComponentAsFunction()` Get the schema component in the form of a function item.
    `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, getParticles, getSimplifiedContentModel, getTerm, isEmpty, markVulnerableSubParticles, setContentModel`

    - ### Methods inherited from class com.saxonica.schema.SchemaStructure

      `elaborate, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, makeXPathExpressionPropertyRecord, 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"

    - #### getComponentAsFunction

          public FunctionItem 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 interface `SchemaComponent`
      Overrides:
        `getComponentAsFunction` in class `ModelGroup`
      Returns:
        the schema component represented as a function from property names to property values.

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