Package net.sf.saxon.type

## Interface ComplexType

- All Superinterfaces:
    `SchemaComponent`, `SchemaType`
  All Known Implementing Classes:
    `AnyType`, `Untyped`, `UserComplexType`

      public interface ComplexType
      extends SchemaType

  A complex type as defined in XML Schema: either a user-defined complex type, or xs:anyType, or xs:untyped. In the non-schema-aware version of the Saxon product, the only complex type encountered is xs:untyped.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface net.sf.saxon.type.SchemaComponent

      `SchemaComponent.ValidationStatus`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `OPEN_CONTENT_ABSENT` |
    `static int` | `OPEN_CONTENT_INTERLEAVE` |
    `static int` | `OPEN_CONTENT_NONE` |
    `static int` | `OPEN_CONTENT_SUFFIX` |
    `static int` | `VARIETY_ELEMENT_ONLY` |
    `static int` | `VARIETY_EMPTY` |
    `static int` | `VARIETY_MIXED` |
    `static int` | `VARIETY_SIMPLE` |

    - ### Fields inherited from interface net.sf.saxon.type.SchemaComponent

      `COMPONENT_FUNCTION_TYPE`

    - ### Fields inherited from interface net.sf.saxon.type.SchemaType

      `DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTION`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `allowsAttributes()` | Return true if this type (or any known type derived from it by extension) allows the element to have one or more attributes.
    `boolean` | `containsElementWildcard()` | Ask whether this type (or any known type derived from it by extension) allows the element to have children that match a wildcard
    `void` | `gatherAllPermittedChildren​(IntHashSet children, boolean ignoreWildcards)` | Get a list of all the names of elements that can appear as children of an element having this complex type, as integer fingerprints.
    `void` | `gatherAllPermittedDescendants​(IntHashSet descendants)` | Get a list of all the names of elements that can appear as descendants of an element having this complex type, as integer fingerprints.
    `int` | `getAttributeUseCardinality​(StructuredQName attributeName)` | Find an attribute use within this complex type definition having a given attribute name (identified by fingerprint), and return the cardinality associated with that attribute, which will always be 0, 1, or 0-or-1.
    `SimpleType` | `getAttributeUseType​(StructuredQName attributeName)` | Find an attribute use within this complex type definition having a given attribute name (identified by fingerprint), and return the schema type associated with that attribute.
    `int` | `getDescendantElementCardinality​(int elementFingerprint)` | Assuming an element is a permitted descendant in the content model of this type, determine the cardinality of the element when it appears as a descendant.
    `SchemaType` | `getDescendantElementType​(int fingerprint)` | Assuming an element is a permitted descendant in the content model of this type, determine the type of the element when it appears as a descendant.
    `int` | `getElementParticleCardinality​(int elementName, boolean considerExtensions)` | Find an element particle within this complex type definition having a given element name (identified by elementName), and return the cardinality associated with that element particle, that is, the number of times the element can occur within this complex type.
    `SchemaType` | `getElementParticleType​(int elementName, boolean considerExtensions)` | Find an element particle within this complex type definition having a given element name (identified by elementName), and return the schema type associated with that element particle.
    `SimpleType` | `getSimpleContentType()` | Get the simple content type.
    `int` | `getVariety()` | Get the variety of this complex type.
    `boolean` | `hasAssertions()` | Ask whether there are any assertions defined on this complex type
    `boolean` | `isAbstract()` | Test whether this complex type has been marked as abstract.
    `boolean` | `isAllContent()` | Test whether this complex type has "all" content, that is, a content model using an xs:all compositor
    `boolean` | `isComplexContent()` | Test whether this complex type has complex content.
    `boolean` | `isEmptiable()` | Test whether the content model of this complex type allows empty content.
    `boolean` | `isEmptyContent()` | Test whether the content model of this complex type is empty.
    `boolean` | `isMixedContent()` | Test whether this complex type allows mixed content.
    `boolean` | `isRestricted()` | Test whether this complex type is derived by restriction.
    `boolean` | `isSimpleContent()` | Test whether this complexType has simple content.

    - ### Methods inherited from interface net.sf.saxon.type.SchemaComponent

      `getComponentAsFunction, getRedefinitionLevel, getValidationStatus`

    - ### Methods inherited from interface net.sf.saxon.type.SchemaType

      `allowsDerivation, analyzeContentExpression, atomize, checkTypeDerivationIsOK, getBaseType, getBlock, getDerivationMethod, getDescription, getDisplayName, getEQName, getFinalProhibitions, getFingerprint, getName, getNearestNamedType, getStructuredQName, getSystemId, getTargetNamespace, isAnonymousType, isAtomicType, isComplexType, isIdRefType, isIdType, isSameType, isSimpleType`

- - ### Field Detail

    - #### VARIETY_EMPTY

          static final int VARIETY_EMPTY

      See Also:
        Constant Field Values

    - #### VARIETY_SIMPLE

          static final int VARIETY_SIMPLE

      See Also:
        Constant Field Values

    - #### VARIETY_ELEMENT_ONLY

          static final int VARIETY_ELEMENT_ONLY

      See Also:
        Constant Field Values

    - #### VARIETY_MIXED

          static final int VARIETY_MIXED

      See Also:
        Constant Field Values

    - #### OPEN_CONTENT_ABSENT

          static final int OPEN_CONTENT_ABSENT

      See Also:
        Constant Field Values

    - #### OPEN_CONTENT_NONE

          static final int OPEN_CONTENT_NONE

      See Also:
        Constant Field Values

    - #### OPEN_CONTENT_INTERLEAVE

          static final int OPEN_CONTENT_INTERLEAVE

      See Also:
        Constant Field Values

    - #### OPEN_CONTENT_SUFFIX

          static final int OPEN_CONTENT_SUFFIX

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getVariety

          int getVariety()

      Get the variety of this complex type. This will be one of the values `VARIETY_EMPTY`, `VARIETY_MIXED`, `VARIETY_SIMPLE`, or `VARIETY_ELEMENT_ONLY`

    - #### isAbstract

          boolean isAbstract()

      Test whether this complex type has been marked as abstract. This corresponds to the {abstract} property in the schema component model.
      Returns:
        true if this complex type is abstract.

    - #### isComplexContent

          boolean isComplexContent()

      Test whether this complex type has complex content. This represents one aspect of the {content type} property in the schema component model.
      Returns:
        true if and only if this complex type has a complex content model, that is, if its variety is one of empty, mixed, or element-only.

    - #### isSimpleContent

          boolean isSimpleContent()

      Test whether this complexType has simple content. This represents one aspect of the {content type} property in the schema component model.
      Returns:
        true if and only if this complex type has a simple content model, that is, if its variety is simple.

    - #### isAllContent

          boolean isAllContent()

      Test whether this complex type has "all" content, that is, a content model using an xs:all compositor
      Returns:
        true if the type has an "all" content model

    - #### getSimpleContentType

          SimpleType getSimpleContentType()
                                   throws MissingComponentException

      Get the simple content type. This represents one aspect of the {content type} property in the schema component model.
      Returns:
        For a complex type with simple content, returns the simple type of the content. Otherwise, returns null.
      Throws:
        `MissingComponentException`

    - #### isRestricted

          boolean isRestricted()

      Test whether this complex type is derived by restriction. This corresponds to one aspect of the {derivation method} property in the schema component model.
      Returns:
        true if this complex type is derived by restriction

    - #### isEmptyContent

          boolean isEmptyContent()

      Test whether the content model of this complex type is empty. This represents one aspect of the {content type} property in the schema component model.
      Returns:
        true if the content model is defined as empty

    - #### isEmptiable

          boolean isEmptiable()
                       throws SchemaException

      Test whether the content model of this complex type allows empty content. This property applies only if this is a complex type with complex content.
      Returns:
        true if empty content is valid
      Throws:
        `SchemaException`

    - #### isMixedContent

          boolean isMixedContent()

      Test whether this complex type allows mixed content. This represents one aspect of the {content type} property in the schema component model. This property applies only if this is a complex type with complex content.
      Returns:
        true if mixed content is allowed

    - #### getElementParticleType

          SchemaType getElementParticleType​(int elementName,
                                            boolean considerExtensions)
                                     throws MissingComponentException

      Find an element particle within this complex type definition having a given element name (identified by elementName), and return the schema type associated with that element particle. If there is no such particle, return null. If the elementName matches an element wildcard, return the type of the global element declaration with the given name if one exists, or AnyType if none exists and lax validation is permitted by the wildcard.
      Parameters:
        `elementName` - Identifies the name of the child element within this content model
        `considerExtensions` - True if types derived from this type by extension are to be included in the search
      Returns:
        the schema type associated with the child element particle with the given name. If there is no such particle, return null.
      Throws:
        `MissingComponentException` - if the schema is incomplete

    - #### getElementParticleCardinality

          int getElementParticleCardinality​(int elementName,
                                            boolean considerExtensions)
                                     throws MissingComponentException

      Find an element particle within this complex type definition having a given element name (identified by elementName), and return the cardinality associated with that element particle, that is, the number of times the element can occur within this complex type. The value is one of `StaticProperty.EXACTLY_ONE`, `StaticProperty.ALLOWS_ZERO_OR_ONE`, `StaticProperty.ALLOWS_ZERO_OR_MORE`, `StaticProperty.ALLOWS_ONE_OR_MORE`, If there is no such particle, return `StaticProperty.EMPTY`.
      Parameters:
        `elementName` - Identifies the name of the child element within this content model
        `considerExtensions` - True if types derived from this type by extension are to be included in the search
      Returns:
        the cardinality associated with the child element particle with the given name. If there is no such particle, return `StaticProperty.EMPTY`.
      Throws:
        `MissingComponentException` - if the schema is incomplete

    - #### getAttributeUseType

          SimpleType getAttributeUseType​(StructuredQName attributeName)
                                  throws SchemaException

      Find an attribute use within this complex type definition having a given attribute name (identified by fingerprint), and return the schema type associated with that attribute. If there is no such attribute use, return null. If the fingerprint matches an attribute wildcard, return the type of the global attribute declaration with the given name if one exists, or AnySimpleType if none exists and lax validation is permitted by the wildcard.

      If there are types derived from this type by extension, search those too.

      Parameters:
        `attributeName` - Identifies the name of the required attribute within this content model
      Returns:
        the schema type associated with the attribute use identified by the fingerprint. If there is no such attribute use, return null.
      Throws:
        `SchemaException`

    - #### getAttributeUseCardinality

          int getAttributeUseCardinality​(StructuredQName attributeName)
                                  throws SchemaException

      Find an attribute use within this complex type definition having a given attribute name (identified by fingerprint), and return the cardinality associated with that attribute, which will always be 0, 1, or 0-or-1. If there is no such attribute use, return 0. If the fingerprint matches an attribute wildcard, return 0-or-1.

      If there are types derived from this type by extension, search those too.

      Parameters:
        `attributeName` - Identifies the name of the required attribute within this content model
      Returns:
        the cardinality associated with the attribute use identified by the fingerprint.
      Throws:
        `SchemaException`

    - #### allowsAttributes

          boolean allowsAttributes()
                            throws MissingComponentException

      Return true if this type (or any known type derived from it by extension) allows the element to have one or more attributes.
      Returns:
        true if attributes (other than the standard xsi: attributes) are allowed. The value false indicates that only the standard attributes in the xsi namespace are permitted.
      Throws:
        `MissingComponentException`

    - #### gatherAllPermittedChildren

          void gatherAllPermittedChildren​(IntHashSet children,
                                          boolean ignoreWildcards)
                                   throws SchemaException

      Get a list of all the names of elements that can appear as children of an element having this complex type, as integer fingerprints. If the list is unbounded (because of wildcards or the use of xs:anyType), return null.
      Parameters:
        `children` - a set, initially empty, which on return will hold the names of all permitted child elements; if the result contains the value -1, this indicates that it is not possible to enumerate all the children, typically because of wildcards. In this case the other contents of the set should be ignored
        `ignoreWildcards` - true if wildcards should be ignored
      Throws:
        `SchemaException`

    - #### gatherAllPermittedDescendants

          void gatherAllPermittedDescendants​(IntHashSet descendants)
                                      throws SchemaException

      Get a list of all the names of elements that can appear as descendants of an element having this complex type, as integer fingerprints. If the list is unbounded (because of wildcards or the use of xs:anyType), include a -1 in the result.
      Parameters:
        `descendants` - a set, initially empty, which on return will hold the names of all permitted descendant elements; if the result contains the value -1, this indicates that it is not possible to enumerate all the descendants, typically because of wildcards. In this case the other contents of the set should be ignored.
      Throws:
        `SchemaException`

    - #### getDescendantElementType

          SchemaType getDescendantElementType​(int fingerprint)
                                       throws SchemaException

      Assuming an element is a permitted descendant in the content model of this type, determine the type of the element when it appears as a descendant. If it appears with more than one type, return xs:anyType.
      Parameters:
        `fingerprint` - the name of the required descendant element
      Returns:
        the type of the descendant element; null if the element cannot appear as a descendant; anyType if it can appear with several different types
      Throws:
        `SchemaException`

    - #### getDescendantElementCardinality

          int getDescendantElementCardinality​(int elementFingerprint)
                                       throws SchemaException

      Assuming an element is a permitted descendant in the content model of this type, determine the cardinality of the element when it appears as a descendant.
      Parameters:
        `elementFingerprint` - the name of the required descendant element
      Returns:
        the cardinality of the descendant element within this complex type
      Throws:
        `SchemaException`

    - #### containsElementWildcard

          boolean containsElementWildcard()
                                   throws MissingComponentException

      Ask whether this type (or any known type derived from it by extension) allows the element to have children that match a wildcard
      Returns:
        true if the content model of this type, or its extensions, contains an element wildcard
      Throws:
        `MissingComponentException`

    - #### hasAssertions

          boolean hasAssertions()

      Ask whether there are any assertions defined on this complex type
      Returns:
        true if there are any assertions