Package net.sf.saxon.type

## Interface SimpleType

- All Superinterfaces:
    `SchemaComponent`, `SchemaType`
  All Known Subinterfaces:
    `AtomicType`, `ListType`
  All Known Implementing Classes:
    `AnySimpleType`, `BuiltInAtomicType`, `BuiltInListType`, `ErrorType`, `NumericType`, `SimpleTypeDefinition`, `UserAtomicType`, `UserListType`, `UserSimpleType`, `UserUnionType`

      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.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface net.sf.saxon.type.SchemaComponent

      `SchemaComponent.ValidationStatus`

  - ### Field Summary

    - ### Fields inherited from interface net.sf.saxon.type.SchemaComponent

      `COMPONENT_FUNCTION_TYPE`

    - ### Fields inherited from interface net.sf.saxon.type.SchemaType

      `DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTION`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `SchemaType` | `getBuiltInBaseType()` | Get the built-in type from which this type is derived by restriction
    `AtomicSequence` | `getTypedValue​(java.lang.CharSequence value, NamespaceResolver resolver, ConversionRules rules)` | Get the typed value corresponding to a given string value, assuming it is valid against this type
    `int` | `getWhitespaceAction()` | Determine how values of this simple type are whitespace-normalized.
    `boolean` | `isAtomicType()` | Test whether this Simple Type is an atomic type
    `boolean` | `isBuiltInType()` | Determine whether this is a built-in type or a user-defined 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
    `java.lang.CharSequence` | `postprocess​(java.lang.CharSequence input)` | Reverse any pre-lexical facets, other than whitespace.
    `java.lang.CharSequence` | `preprocess​(java.lang.CharSequence input)` | Apply any pre-lexical facets, other than whitespace.
    `ValidationFailure` | `validateContent​(java.lang.CharSequence value, NamespaceResolver nsResolver, ConversionRules rules)` | Check whether a given input string is valid according to this SimpleType

    - ### Methods inherited from interface net.sf.saxon.type.SchemaComponent

      `getComponentAsFunction, getRedefinitionLevel, getValidationStatus`

    - ### Methods inherited from interface net.sf.saxon.type.SchemaType

      `allowsDerivation, analyzeContentExpression, atomize, checkTypeDerivationIsOK, getBaseType, getBlock, getDerivationMethod, getDescription, getDisplayName, getEQName, getFinalProhibitions, getFingerprint, getName, getNearestNamedType, getStructuredQName, getSystemId, getTargetNamespace, isAnonymousType, isComplexType, isIdRefType, isIdType, isSameType, isSimpleType`

- - ### Method Detail

    - #### isAtomicType

          boolean isAtomicType()

      Test whether this Simple Type is an atomic type
      Specified by:
        `isAtomicType` in interface `SchemaType`
      Returns:
        true if this is an atomic type

    - #### isListType

          boolean isListType()

      Test whether this Simple Type is a list type
      Returns:
        true if this is a list type

    - #### isUnionType

          boolean isUnionType()

      Test whether this Simple Type is a union type
      Returns:
        true if this is a union type

    - #### isBuiltInType

          boolean isBuiltInType()

      Determine whether this is a built-in type or a user-defined type
      Returns:
        true if this is a built-in type

    - #### getBuiltInBaseType

          SchemaType getBuiltInBaseType()

      Get the built-in type from which this type is derived by restriction
      Returns:
        the built-in type from which this type is derived by restriction. This will not necessarily be a primitive type.

    - #### getTypedValue

          AtomicSequence getTypedValue​(java.lang.CharSequence value,
                                       NamespaceResolver resolver,
                                       ConversionRules rules)
                                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.
        `rules` - the conversion rules from the configuration
      Returns:
        the atomic sequence comprising the typed value. The objects returned by this SequenceIterator will all be of type `AtomicValue`,
      Throws:
        `ValidationException` - if the supplied value is not in the lexical space of the data type

    - #### validateContent

          ValidationFailure validateContent​(java.lang.CharSequence value,
                                            NamespaceResolver nsResolver,
                                            ConversionRules rules)

      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.
        `rules` - the conversion rules from the configuration
      Returns:
        null if validation succeeds; or return a ValidationFailure 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

          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, or if the namespace-sensitivity cannot be determined because there are missing schema components. (However, for xs:anyAtomicType, the result returned is false, even though the type allows xs:QName instances.)

    - #### getWhitespaceAction

          int getWhitespaceAction()

      Determine how values of this simple type are whitespace-normalized.
      Returns:
        one of `Whitespace.PRESERVE`, `Whitespace.COLLAPSE`, `Whitespace.REPLACE`.

    - #### preprocess

          java.lang.CharSequence preprocess​(java.lang.CharSequence input)
                                     throws ValidationException

      Apply any pre-lexical facets, other than whitespace. At the moment the only such facet is saxon:preprocess
      Parameters:
        `input` - the value to be preprocessed
      Returns:
        the value after preprocessing
      Throws:
        `ValidationException` - if preprocessing detects that the value is invalid

    - #### postprocess

          java.lang.CharSequence postprocess​(java.lang.CharSequence input)
                                      throws ValidationException

      Reverse any pre-lexical facets, other than whitespace. At the moment the only such facet is saxon:preprocess. This is called when converting a value of this type to a string
      Parameters:
        `input` - the value to be postprocessed: this is the "ordinary" result of converting the value to a string
      Returns:
        the value after postprocessing
      Throws:
        `ValidationException` - if postprocessing detects that the value is invalid