net.sf.saxon.type
Interface SimpleType

All Superinterfaces:
SchemaComponent, SchemaType, java.io.Serializable
All Known Subinterfaces:
AtomicType, ListType
All Known Implementing Classes:
AnySimpleType, BuiltInAtomicType, BuiltInListType, ExternalObjectType, UserAtomicType, UserListType, UserSimpleType

public interface SimpleType
extends SchemaType

This interface represents a simple type, which may be a built-in simple type, or a user-defined simple type.


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 getBuiltInBaseType()
           
 AtomicType getCommonAtomicType()
          Get the most specific possible atomic type that all items in this SimpleType belong to
 SequenceIterator getTypedValue(java.lang.CharSequence value, NamespaceResolver resolver, NameChecker nameChecker)
          Get the typed value corresponding to a given string value, assuming it is valid against this type
 int getWhitespaceAction(TypeHierarchy th)
          Determine how values of this simple type are whitespace-normalized.
 boolean isAtomicType()
          Test whether this Simple Type is an atomic type
 boolean isListType()
          Test whether this Simple Type is a list type
 boolean isNamespaceSensitive()
          Test whether this type is namespace sensitive, that is, if a namespace context is needed to translate between the lexical space and the value space.
 boolean isUnionType()
          Test whether this Simple Type is a union type
 ValidationException validateContent(java.lang.CharSequence value, NamespaceResolver nsResolver, NameChecker nameChecker)
          Check whether a given input string is valid according to this SimpleType
 
Methods inherited from interface net.sf.saxon.type.SchemaType
allowsDerivation, analyzeContentExpression, atomize, getBaseType, getBlock, getDerivationMethod, getDescription, getDisplayName, getFingerprint, getNameCode, getTypedValue, isComplexType, isSameType, isSimpleType, isTypeDerivationOK
 
Methods inherited from interface net.sf.saxon.type.SchemaComponent
getValidationStatus
 

Method Detail

isAtomicType

public boolean isAtomicType()
Test whether this Simple Type is an atomic type

Returns:
true if this is an atomic type

isListType

public boolean isListType()
Test whether this Simple Type is a list type

Returns:
true if this is a list type

isUnionType

public boolean isUnionType()
Test whether this Simple Type is a union type

Returns:
true if this is a union type

getCommonAtomicType

public AtomicType getCommonAtomicType()
Get the most specific possible atomic type that all items in this SimpleType belong to

Returns:
the lowest common supertype of all member types

getBuiltInBaseType

public SchemaType getBuiltInBaseType()
                              throws ValidationException
Throws:
ValidationException

getTypedValue

public SequenceIterator getTypedValue(java.lang.CharSequence value,
                                      NamespaceResolver resolver,
                                      NameChecker nameChecker)
                               throws ValidationException
Get the typed value corresponding to a given string value, assuming it is valid against this type

Parameters:
value - the string value
resolver - a namespace resolver used to resolve any namespace prefixes appearing in the content of values. Can supply null, in which case any namespace-sensitive content will be rejected.
nameChecker -
Returns:
an iterator over the atomic sequence comprising the typed value. The objects returned by this SequenceIterator will all be of type AtomicValue
Throws:
ValidationException

validateContent

public ValidationException validateContent(java.lang.CharSequence value,
                                           NamespaceResolver nsResolver,
                                           NameChecker nameChecker)
Check whether a given input string is valid according to this SimpleType

Parameters:
value - the input string to be checked
nsResolver - a namespace resolver used to resolve namespace prefixes if the type is namespace sensitive. The value supplied may be null; in this case any namespace-sensitive content will throw an UnsupportedOperationException.
nameChecker -
Returns:
null if validation succeeds; return a ValidationException describing the validation failure if validation fails. Note that the exception is returned rather than being thrown.
Throws:
java.lang.UnsupportedOperationException - if the type is namespace-sensitive and no namespace resolver is supplied

isNamespaceSensitive

public boolean isNamespaceSensitive()
Test whether this type is namespace sensitive, that is, if a namespace context is needed to translate between the lexical space and the value space. This is true for types derived from, or containing, QNames and NOTATIONs

Returns:
true if the type is namespace-sensitive

getWhitespaceAction

public int getWhitespaceAction(TypeHierarchy th)
Determine how values of this simple type are whitespace-normalized.

Parameters:
th -
Returns:
one of Whitespace.PRESERVE, Whitespace.COLLAPSE, Whitespace.REPLACE.