## net.sf.saxon.type
Class SimpleType

    java.lang.Object
      |
      +--net.sf.saxon.type.SchemaType
            |
            +--net.sf.saxon.type.SimpleType

All Implemented Interfaces:
  java.io.Serializable, javax.xml.transform.SourceLocator, TypeInfo

Direct Known Subclasses:
  AtomicType, ListType

public abstract class SimpleType
extends SchemaType

This class represents a simple type, as defined in the XML Schema specification. This may be an atomic type, a list type, or a union type. In the non-schema-aware version of Saxon, the simple type will always be a built-in type. With the schema-aware product, it may also be a user-defined simple type.

See Also:
  Serialized Form

Field Summary

Fields inherited from class net.sf.saxon.type.SchemaType
`DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTION, finalProhibitions, INVALID, UNVALIDATED, VALIDATED, VALIDATING, validationPhase`

Constructor Summary
`SimpleType()`

Method Summary
`java.lang.CharSequence` `applyWhitespaceNormalization(java.lang.CharSequence value)` Apply the whitespace normalization rules for this simple type
`SimpleType` `getBuiltInBaseType()` Returns the built-in base type this type is derived from.
`Facet` `getFacet(java.lang.String name)` Returns the first facet associated with the given name, defined either on this type or on a type from which it is derived
`FacetCollection` `getFacetCollection()` Get the FacetCollection for this simple type
`java.util.Iterator` `getFacets()` Returns an Iterator over all the Facets (including inherited facets) for this type.
`java.util.Iterator` `getFacets(java.lang.String name)` Return all the facets having the given name
`abstract SequenceIterator` `getTypedValue(java.lang.CharSequence value, NamespaceResolver resolver)` Get the typed value corresponding to a given string value, assuming it is valid against this type
`SequenceIterator` `getTypedValue(NodeInfo node)` Get the typed value of a node that is annotated with this schema type
`int` `getWhitespaceAction()` Determine the whitespace normalization required for values of this type
`boolean` `isListType()` Returns true if this type is derived by list, or if it is derived by restriction from a list type, or if it is a union that contains a list as one of its members
`boolean` `isNamespaceSensitive()` Test whether this simple type is namespace-sensitive, that is, whether it is derived from xs:QName or xs:NOTATION
`boolean` `isSimpleType()` Returns true if this SchemaType is a SimpleType
`java.lang.String` `isTypeDerivationOK(SimpleType b, int derivation)` Check whether type derivation is allowed.
`boolean` `isUnionType()` Return true if this type is a union type (that is, if its variety is union)
`java.util.Iterator` `iterateMemberTypes()` Returns an Iterator over all the SimpleTypes that are members of a union type.
`void` `setFacetCollection(FacetCollection facets)` Set the FacetCollection for this simple type.
`boolean` `validate(SchemaMarker schema)` Checks the validity of this SimpleType definition.
`abstract void` `validateContent(java.lang.CharSequence value, NamespaceResolver nsResolver)` Check whether a given input string is valid according to this SimpleType

Methods inherited from class net.sf.saxon.type.SchemaType

`allowsDerivation, checkDerivation, containingDeclarationIsElement, getBaseType, getBaseTypeFingerprint, getBlock, getColumnNumber, getContainingDeclarationName, getDerivationMethod, getDescription, getDisplayName, getFingerprint, getLineNumber, getLocalName, getNamePool, getPublicId, getSystemId, getTypeName, getTypeNamespace, isComplexType, isDerivedFrom, isSameType, relationshipTo, setBaseType, setBaseTypeFingerprint, setContainingDeclaration, setDerivationMethod, setDerivationMethodName, setFinalProhibitions, setFingerprint, setLineNumber, setLocalName, setLocator, setNamePool, setSystemId`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SimpleType

    public SimpleType()

Method Detail

### isSimpleType

    public final boolean isSimpleType()

  Returns true if this SchemaType is a SimpleType

  Specified by:
    `isSimpleType` in class `SchemaType`
  Returns:
    true (always)

### isListType

    public boolean isListType()

  Returns true if this type is derived by list, or if it is derived by restriction from a list type, or if it is a union that contains a list as one of its members

  Returns:
    true if this is a list type

### isUnionType

    public boolean isUnionType()

  Return true if this type is a union type (that is, if its variety is union)

  Returns:
    true for a union type

### iterateMemberTypes

    public java.util.Iterator iterateMemberTypes()

  Returns an Iterator over all the SimpleTypes that are members of a union type. Note that this is not transitive: if the union has another union as a membertype, the iteration will return this union rather than its members.

  Returns:
    For union types, return an Iterator over all member SimpleTypes. For non-union types, return null.

### setFacetCollection

    public void setFacetCollection(FacetCollection facets)

  Set the FacetCollection for this simple type. For internal use only.

  Parameters:
    `facets` - the collection of facets for this type.

### getFacetCollection

    public FacetCollection getFacetCollection()

  Get the FacetCollection for this simple type

  Returns:
    a FacetCollection containing all the facets locally declared on this simple type (and providing access to the inherited facets also)

### getFacet

    public Facet getFacet(java.lang.String name)

  Returns the first facet associated with the given name, defined either on this type or on a type from which it is derived

  Returns:
    the first facet associated with the given name

### getFacets

    public java.util.Iterator getFacets(java.lang.String name)

  Return all the facets having the given name

  Returns:
    an iterator over all the facets with the given name, including those defined on a type from which this is derived by restriction or by union

### getFacets

    public java.util.Iterator getFacets()

  Returns an Iterator over all the Facets (including inherited facets) for this type.

  Returns:
    an Iterator over all the Facets for this type.

### getWhitespaceAction

    public int getWhitespaceAction()

  Determine the whitespace normalization required for values of this type

  Returns:
    one of PRESERVE, REPLACE, COLLAPSE

### applyWhitespaceNormalization

    public java.lang.CharSequence applyWhitespaceNormalization(java.lang.CharSequence value)

  Apply the whitespace normalization rules for this simple type

  Parameters:
    `value` - the string before whitespace normalization
  Returns:
    the string after whitespace normalization

### getBuiltInBaseType

    public SimpleType getBuiltInBaseType()

  Returns the built-in base type this type is derived from.

  Returns:
    the first built-in type found when searching up the type hierarchy

### isNamespaceSensitive

    public boolean isNamespaceSensitive()

  Test whether this simple type is namespace-sensitive, that is, whether it is derived from xs:QName or xs:NOTATION

  Returns:
    true if this type is derived from xs:QName or xs:NOTATION

### isTypeDerivationOK

    public java.lang.String isTypeDerivationOK(SimpleType b,
                                               int derivation)

  Check whether type derivation is allowed. This implements the Schema Component Constraint: Type Derivation OK (Simple). This type is D (the derived type); the type supplied as an argument is B (the base type), and the argument (a subset (extension, restriction, list, union)) is provided in the second argument. If type derivation is allowed, the method return null; otherwise it returns a string that can be used as an error message

  Parameters:
    `b` - the base type
    `derivation` - the disallowed derivations, as a bit-significant integer
  Returns:
    null if type derivation is OK; otherwise a string that can be used as an error message

### validate

    public boolean validate(SchemaMarker schema)
                     throws SchemaException

  Checks the validity of this SimpleType definition.

  Parameters:
    `schema` - a Schema used for error reporting
  Throws:
    `SchemaException` - if this SimpleType definition is invalid.

### validateContent

    public abstract void validateContent(java.lang.CharSequence value,
                                         NamespaceResolver nsResolver)
                                  throws ValidationException

  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.
  Throws:
    `ValidationException` - if the content is invalid
    `java.lang.UnsupportedOperationException` - if the type is namespace-sensitive and no namespace resolver is supplied

### getTypedValue

    public final SequenceIterator getTypedValue(NodeInfo node)
                                         throws XPathException

  Get the typed value of a node that is annotated with this schema type

  Specified by:
    `getTypedValue` in class `SchemaType`
  Parameters:
    `node` - the node whose typed value is required
  Returns:
    an iterator over the items making up the typed value of this node. The objects returned by this SequenceIterator will all be of type `AtomicValue`
    `XPathException`

### getTypedValue

    public abstract SequenceIterator getTypedValue(java.lang.CharSequence value,
                                                   NamespaceResolver resolver)
                                            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.
  Returns:
    an iterator over the atomic sequence comprising the typed value. The objects returned by this SequenceIterator will all be of type `AtomicValue`
    `ValidationException`