net.sf.saxon.type

Interface ComplexType

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
static intOPEN_CONTENT_ABSENT
static intOPEN_CONTENT_INTERLEAVE
static intOPEN_CONTENT_NONE
static intOPEN_CONTENT_SUFFIX
static intVARIETY_ELEMENT_ONLY
static intVARIETY_EMPTY
static intVARIETY_MIXED
static intVARIETY_SIMPLE
Method Summary
booleanallowsAttributes()
Return true if this type (or any known type derived from it by extension) allows the element to have one or more attributes.
booleancontainsElementWildcard()
Ask whether this type (or any known type derived from it by extension) allows the element to have children that match a wildcard
voidgatherAllPermittedChildren(IntHashSet children)
Get a list of all the names of elements that can appear as children of an element having this complex type, as integer fingerprints.
voidgatherAllPermittedDescendants(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.
SimpleTypegetAttributeUseType(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.
intgetElementParticleCardinality(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.
SchemaTypegetElementParticleType(int fingerprint, boolean considerExtensions)
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.
SimpleTypegetSimpleContentType()
Get the simple content type.
intgetVariety()
Get the variety of this complex type.
booleanisAbstract()
Test whether this complex type has been marked as abstract.
booleanisAllContent()
Test whether this complex type has "all" content, that is, a content model using an xs:all compositor
booleanisComplexContent()
Test whether this complex type has complex content.
booleanisEmptiable()
Test whether the content model of this complex type allows empty content.
booleanisEmptyContent()
Test whether the content model of this complex type is empty.
booleanisMixedContent()
Test whether this complex type allows mixed content.
booleanisRestricted()
Test whether this complex type is derived by restriction.
booleanisSimpleContent()
Test whether this complexType has simple content.

Field Detail

OPEN_CONTENT_ABSENT

public static final int OPEN_CONTENT_ABSENT

OPEN_CONTENT_INTERLEAVE

public static final int OPEN_CONTENT_INTERLEAVE

OPEN_CONTENT_NONE

public static final int OPEN_CONTENT_NONE

OPEN_CONTENT_SUFFIX

public static final int OPEN_CONTENT_SUFFIX

VARIETY_ELEMENT_ONLY

public static final int VARIETY_ELEMENT_ONLY

VARIETY_EMPTY

public static final int VARIETY_EMPTY

VARIETY_MIXED

public static final int VARIETY_MIXED

VARIETY_SIMPLE

public static final int VARIETY_SIMPLE

Method Detail

allowsAttributes

public 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.

Returns: true if attributes are allowed

containsElementWildcard

public 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

Returns: true if the content model of this type, or its extensions, contains an element wildcard

gatherAllPermittedChildren

public void gatherAllPermittedChildren(IntHashSet children)
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 an integer set, initially empty, which on return will hold the fingerprints 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.

gatherAllPermittedDescendants

public 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. If the list is unbounded (because of wildcards or the use of xs:anyType), include a -1 in the result.

Parameters: descendants an integer set, initially empty, which on return will hold the fingerprints 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.

getAttributeUseType

public SimpleType 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. 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

Returns: the schema type associated with the attribute use identified by the fingerprint. If there is no such attribute use, return null.

getElementParticleCardinality

public 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. The value is one of EXACTLY_ONE, ALLOWS_ZERO_OR_ONE, ALLOWS_ZERO_OR_MORE, ALLOWS_ONE_OR_MORE, If there is no such particle, return EMPTY.

Parameters: fingerprint Identifies the name of the child element within this content model

Returns: the cardinality associated with the child element particle with the given name. If there is no such particle, return EMPTY.

getElementParticleType

public SchemaType getElementParticleType(int fingerprint, boolean considerExtensions)
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 considerExtensions

Returns: the schema type associated with the child element particle with the given name. If there is no such particle, return null.

getSimpleContentType

public 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.

getVariety

public 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

public 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.

isAllContent

public 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

isComplexContent

public 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.

isEmptiable

public boolean isEmptiable()
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

isEmptyContent

public 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

isMixedContent

public 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

isRestricted

public 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

isSimpleContent

public 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.