net.sf.saxon.type
Interface ComplexType

All Superinterfaces:
SchemaComponent, SchemaType, Serializable
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.


Field Summary
 
Fields inherited from interface net.sf.saxon.type.SchemaType
DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTION
 
Fields inherited from interface net.sf.saxon.type.SchemaComponent
FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING
 
Method Summary
 SchemaType getAttributeUseType(int fingerprint)
          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 getElementParticleCardinality(int fingerprint)
          Find an element particle within this complex type definition having a given element name (identified by fingerprint), 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 fingerprint)
          Find an element particle within this complex type definition having a given element name (identified by fingerprint), and return the schema type associated with that element particle.
 SimpleType getSimpleContentType()
          Get the simple content 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.
 String subsumes(ComplexType sub, ISchemaCompiler compiler)
          Test whether this complex type subsumes another complex type.
 
Methods inherited from interface net.sf.saxon.type.SchemaType
allowsDerivation, analyzeContentExpression, atomize, checkTypeDerivationIsOK, getBaseType, getBlock, getDerivationMethod, getDescription, getDisplayName, getFingerprint, getNameCode, getTypedValue, isAnonymousType, isAtomicType, isComplexType, isSameType, isSimpleType
 
Methods inherited from interface net.sf.saxon.type.SchemaComponent
getValidationStatus
 

Method Detail

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 this complex type has a complex content model, false if it has a simple content model

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 this complex type has a simple content model, false if it has a complex content model

isAllContent

boolean isAllContent()
Test whether this complex type has "all" content, that is, a content model using an xs:all compositor


getSimpleContentType

SimpleType getSimpleContentType()
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.

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,
                           ValidationException
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
ValidationException

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

subsumes

String subsumes(ComplexType sub,
                ISchemaCompiler compiler)
                throws SchemaException,
                       ValidationException
Test whether this complex type subsumes another complex type. The algorithm used is as published by Thompson and Tobin, XML Europe 2003.

Parameters:
sub - the other type (the type that is derived by restriction, validly or otherwise)
compiler -
Returns:
null indicating that this type does indeed subsume the other; or a string indicating why it doesn't.
Throws:
SchemaException
ValidationException

getElementParticleType

SchemaType getElementParticleType(int fingerprint)
                                  throws SchemaException,
                                         ValidationException
Find an element particle within this complex type definition having a given element name (identified by fingerprint), and return the schema type associated with that element particle. If there is no such particle, return null. If the fingerprint 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:
fingerprint - Identifies the name of the child element within this content model
Throws:
SchemaException
ValidationException

getElementParticleCardinality

int getElementParticleCardinality(int fingerprint)
                                  throws SchemaException,
                                         ValidationException
Find an element particle within this complex type definition having a given element name (identified by fingerprint), 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:
fingerprint - Identifies the name of the child element within this content model
Throws:
SchemaException
ValidationException

getAttributeUseType

SchemaType getAttributeUseType(int fingerprint)
                               throws SchemaException,
                                      ValidationException
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:
fingerprint - Identifies the name of the child element within this content model
Throws:
SchemaException
ValidationException


Copyright (C) Michael H. Kay. All rights reserved.