com.saxonica.schema

## Class ChoiceModelGroup

- java.lang.Object
- - com.saxonica.schema.SchemaStructure
  - - com.saxonica.schema.ModelGroup
    - - com.saxonica.schema.ChoiceModelGroup

- All Implemented Interfaces:
    Term, UserSchemaComponent, Serializable, SourceLocator, SchemaComponent

      public class ChoiceModelGroup
      extends ModelGroup

  A ChoiceCompositor represents an xs:choice element in the schema
  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
    `ChoiceModelGroup()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getCompositorName()` Get the name of this compositor
    `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)
    `void` | `markVulnerableSubParticles(boolean isRepeatable)` Mark contained particles as vulnerable.
    `boolean` | `validate(SchemaCompiler compiler)` Checks the validity of this Compositor definition.

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

      `addParticle, checkElements, compile, containsAll, containsElementWildcard, fixup, gatherAllPermittedElements, getComponentAsFunction, getContentModelSize, getElementParticleCardinality, getElementParticleType, getParticles, getSimplifiedContentModel, getTerm, isEmpty, lookForCycles, serialize, 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

    - #### ChoiceModelGroup

          public ChoiceModelGroup()

  - ### Method Detail

    - #### isEmptiable

          public boolean isEmptiable()
                              throws UnresolvedReferenceException

      Determine if empty content is allowed
      Specified by:
        `isEmptiable` in class `ModelGroup`
      Returns:
        true if empty content matches this compositor, which is true if the compositor as a whole has minOccurs=0, or if any of the choices 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` - not used
      Returns:
        true if the particle is pointless (which effectively means it can't match anything)

    - #### markVulnerableSubParticles

          public void markVulnerableSubParticles(boolean isRepeatable)

      Mark contained particles as vulnerable. A particle is marked as vulnerable if everything both before and after it in the content model is optional. This contributes to the algorithm for deciding whether counting states can be used for this particle in the finite state machine
      Overrides:
        `markVulnerableSubParticles` in class `ModelGroup`
      Parameters:
        `isRepeatable` - set to true if this part of the content model can be repeated

    - #### validate

          public boolean validate(SchemaCompiler compiler)
                           throws SchemaException

      Checks the validity of this Compositor definition.
      Specified by:
        `validate` in interface `UserSchemaComponent`
      Overrides:
        `validate` in class `ModelGroup`
      Returns:
        true when this Schema definition is valid, otherwise false.
      Throws:
        `SchemaException` - when the error listener decides an error is fatal

    - #### getCompositorName

          public String getCompositorName()

      Get the name of this compositor
      Specified by:
        `getCompositorName` in class `ModelGroup`
      Returns:
        one of "sequence", "choice", or "all"

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