net.sf.saxon.type

Class Untyped

public final class Untyped extends Object implements ComplexType, Serializable

This class has a singleton instance which represents the complex type xdt:untyped, used for elements that have not been validated.
Method Summary
booleanallowsDerivation(int derivation)
Determines whether derivation (of a particular kind) from this type is allowed, based on the "final" property
voidanalyzeContentExpression(Expression expression, int kind, StaticContext env)
Analyze an expression to see whether the expression is capable of delivering a value of this type.
Valueatomize(NodeInfo node)
Get the typed value of a node that is annotated with this schema type.
SchemaTypegetAttributeUseType(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.
SchemaTypegetBaseType()
Returns the base type that this type inherits from.
intgetBlock()
Returns the value of the 'block' attribute for this type, as a bit-signnificant integer with fields such as DERIVATION_LIST and DERIVATION_EXTENSION
intgetDerivationMethod()
Gets the integer code of the derivation method used to derive this type from its parent.
StringgetDescription()
Get a description of this type for use in diagnostics
StringgetDisplayName()
Get the display name of the type: that is, a lexical QName with an arbitrary prefix
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)
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.
intgetFingerprint()
Get the fingerprint of the name of this type
static UntypedgetInstance()
Get the singular instance of this class
SchemaTypegetKnownBaseType()
Returns the base type that this type inherits from.
intgetNameCode()
Get the namecode of the name of this type.
SimpleTypegetSimpleContentType()
For a complex type with simple content, return the simple type of the content.
SequenceIteratorgetTypedValue(NodeInfo node)
Get the typed value of a node that is annotated with this schema type
intgetValidationStatus()
Get the validation status - always valid
booleanisAbstract()
Test whether this ComplexType 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
booleanisComplexType()
Test whether this SchemaType is a complex type
booleanisEmptiable()
Test whether the content model of this complexType allows empty content
booleanisEmptyContent()
Test whether the content type 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
booleanisSameType(SchemaType other)
Test whether this is the same type as another type.
booleanisSimpleContent()
Test whether this complex type has simple content
booleanisSimpleType()
Test whether this SchemaType is a simple type
voidisTypeDerivationOK(SchemaType type, int block)
Check that this type is validly derived from a given type
Stringsubsumes(ComplexType sub)
Test whether this complex type subsumes another complex type.

Method Detail

allowsDerivation

public boolean allowsDerivation(int derivation)
Determines whether derivation (of a particular kind) from this type is allowed, based on the "final" property

Parameters: derivation the kind of derivation, for example DERIVATION_LIST

Returns: true if this kind of derivation is allowed

analyzeContentExpression

public void analyzeContentExpression(Expression expression, int kind, StaticContext env)
Analyze an expression to see whether the expression is capable of delivering a value of this type.

Parameters: expression the expression that delivers the content kind the node kind whose content is being delivered: ELEMENT, ATTRIBUTE, or DOCUMENT env

atomize

public Value atomize(NodeInfo node)
Get the typed value of a node that is annotated with this schema type. The result of this method will always be consistent with the method Untyped. However, this method is often more convenient and may be more efficient, especially in the common case where the value is expected to be a singleton.

Parameters: node the node whose typed value is required

Returns: the typed value.

Since: 8.5

getAttributeUseType

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

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

getBaseType

public SchemaType getBaseType()
Returns the base type that this type inherits from. If this type is a Simpletype that is a built in primitive type then null is returned.

Returns: the base type.

getBlock

public int getBlock()
Returns the value of the 'block' attribute for this type, as a bit-signnificant integer with fields such as DERIVATION_LIST and DERIVATION_EXTENSION

Returns: the value of the 'block' attribute for this type

getDerivationMethod

public int getDerivationMethod()
Gets the integer code of the derivation method used to derive this type from its parent. Returns zero for primitive types.

Returns: a numeric code representing the derivation method, for example DERIVATION_RESTRICTION

getDescription

public String getDescription()
Get a description of this type for use in diagnostics

Returns: the string "xs:anyType"

getDisplayName

public String getDisplayName()
Get the display name of the type: that is, a lexical QName with an arbitrary prefix

Returns: a lexical QName identifying the type

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

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

getElementParticleType

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

getFingerprint

public int getFingerprint()
Get the fingerprint of the name of this type

Returns: the fingerprint. Returns an invented fingerprint for an anonymous type.

getInstance

public static Untyped getInstance()
Get the singular instance of this class

Returns: the singular object representing xs:anyType

getKnownBaseType

public SchemaType getKnownBaseType()
Returns the base type that this type inherits from. This method can be used to get the base type of a type that is known to be valid. If this type is a Simpletype that is a built in primitive type then null is returned.

Returns: the base type.

Throws: IllegalStateException if this type is not valid.

getNameCode

public int getNameCode()
Get the namecode of the name of this type. This includes the prefix from the original type declaration: in the case of built-in types, there may be a conventional prefix or there may be no prefix.

getSimpleContentType

public SimpleType getSimpleContentType()
For a complex type with simple content, return the simple type of the content. Otherwise, return null.

Returns: null: this complex type does not have simple content

getTypedValue

public SequenceIterator getTypedValue(NodeInfo node)
Get the typed value of a node that is annotated with this schema type

Parameters: node the node whose typed value is required

Returns: an iterator returning a single untyped atomic value, equivalent to the string value of the node. This follows the standard rules for elements with mixed content.

getValidationStatus

public int getValidationStatus()
Get the validation status - always valid

isAbstract

public boolean isAbstract()
Test whether this ComplexType has been marked as abstract.

Returns: false: this class is not abstract.

isAllContent

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

Returns: false: this complex type does not use an "all" compositor

isComplexContent

public boolean isComplexContent()
Test whether this complex type has complex content

Returns: true: this complex type has complex content

isComplexType

public boolean isComplexType()
Test whether this SchemaType is a complex type

Returns: true if this SchemaType is a complex type

isEmptiable

public boolean isEmptiable()
Test whether the content model of this complexType allows empty content

Returns: true: the content is allowed to be empty

isEmptyContent

public boolean isEmptyContent()
Test whether the content type of this complex type is empty

Returns: false: the content model is not empty

isMixedContent

public boolean isMixedContent()
Test whether this complex type allows mixed content

Returns: true: mixed content is allowed

isRestricted

public boolean isRestricted()
Test whether this complex type is derived by restriction

Returns: true: this type is treated as a restriction of xs:anyType

isSameType

public boolean isSameType(SchemaType other)
Test whether this is the same type as another type. 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)

isSimpleContent

public boolean isSimpleContent()
Test whether this complex type has simple content

Returns: false: this complex type has complex content

isSimpleType

public boolean isSimpleType()
Test whether this SchemaType is a simple type

Returns: true if this SchemaType is a simple type

isTypeDerivationOK

public void isTypeDerivationOK(SchemaType type, int block)
Check that this type is validly derived from a given type

Parameters: type the type from which this type is derived block the derivations that are blocked by the relevant element declaration

subsumes

public String subsumes(ComplexType sub)
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)

Returns: null indicating that this type does indeed subsume the other; or a string indicating why it doesn't.