# Package net.sf.saxon.type

This package contains classes that implement the XPath 2.0 and 3.1 type system. It contains that part of the functionality relevant to a non-schema-aware implementation: that is, the overall structure of the type system, together with representations of the built-in types.

The hierarchy of schema types is represented by the interfaces `SchemaType`, `ComplexType`, `SimpleType`, `ListType`, and `AtomicType`. (Union types never arise in non-schema-aware processing). There are concrete classes representing built-in types such as `AnyType`, `BuiltInAtomicType`, and `BuiltInListType`: the corresponding classes for user-defined types are in the `com.saxonica.schema` package.

The class `SequenceType` ought logically to be in this package but is actually in `net.sf.saxon.value`. A sequence type contains an `ItemType` which may be an `AtomicType` or a `NodeTest`: NodeTests are found in the package `net.sf.saxon.pattern`.

The logic for performing type checking is partly in the singleton class `Type` (which also contains many useful constants), and partly in the class `TypeChecker` found in package `net.sf.saxon.expr`.

- Interface Summary
  Interface | Description
  --- | ---
  AtomicType | Interface for atomic types (these are either built-in atomic types or user-defined atomic types).
  CastingTarget | This marker interface represents a type that can be used as the target of a cast or castable operation, that is, an atomic type, list type, or plain union type
  ComplexType | A complex type as defined in XML Schema: either a user-defined complex type, or xs:anyType, or xs:untyped.
  ConversionResult | This is a marker interface used as the result of methods that convert or cast values from one type to another.
  FunctionItemType | Higher-order functions in XPath 3.0 introduce a third kind of Item, namely a Function Item.
  ItemType | ItemType is an interface that allows testing of whether an Item conforms to an expected type.
  ItemType.WithSequenceTypeCache | Extension of the ItemType interface implemented by some item types, to provide a cache of SequenceType objects based on this item type, with different occurrence indicators.
  ListType | Interface representing a simple type of variety List
  PlainType | A "plain type" is either an atomic type, or a union type that (a) imposes no restrictions other than those imposed by its member types, and (b) has exclusively plain types as its member types
  SchemaComponent | This is a marker interface that represents any "schema component" as defined in the XML Schema specification.
  SchemaDeclaration | This is a marker interface that acts as a surrogate for an object representing a global element or attribute declaration.
  SchemaType | SchemaType is an interface implemented by all schema types: simple and complex types, built-in and user-defined types.
  SimpleType | This interface represents a simple type, which may be a built-in simple type, or a user-defined simple type.
  UnionType | Interface representing a union type.

- Class Summary
  Class | Description
  --- | ---
  AlphaCode | An AlphaCode is a compact, context-independent string representation of a SequenceType
  AnyExternalObjectType | This class represents the type of an external object returned by an extension function, or supplied as an external variable/parameter.
  AnyFunctionType | An ItemType representing the type function(*).
  AnyFunctionTypeWithAssertions | The item type function(*) when it is preceded by one or more annotation assertions
  AnyItemType | An implementation of ItemType that matches any item (node or atomic value)
  BuiltInAtomicType | This class represents a built-in atomic type, which may be either a primitive type (such as xs:decimal or xs:anyURI) or a derived type (such as xs:ID or xs:dayTimeDuration).
  BuiltInListType | This class is used to implement the built-in list types NMTOKENS, ENTITIES, IDREFS.
  BuiltInType | This non-instantiable class acts as a register of Schema objects containing all the built-in types: that is, the types defined in the "xs" namespace.
  Converter | A converter implements conversions from one atomic type to another - that is, it implements the casting rules for a (source type, destination type) pair.
  Converter.Base64BinaryToHexBinary | Converts base64 to hexBinary
  Converter.BooleanToDecimal | Converts a boolean to a decimal
  Converter.BooleanToDouble | Converts a boolean to a double
  Converter.BooleanToFloat | Converts a boolean to an xs:float
  Converter.BooleanToInteger | Converts a boolean to an integer
  Converter.DateTimeToDate | Converts a dateTime to a date
  Converter.DateTimeToGDay | Converts a dateTime to a gDay
  Converter.DateTimeToGMonth | Converts a dateTime to a gMonth
  Converter.DateTimeToGMonthDay | Converts a dateTime to a gMonthDay
  Converter.DateTimeToGYear | Converts a dateTime to a gYear
  Converter.DateTimeToGYearMonth | Converts a dateTime to a gYearMonth
  Converter.DateTimeToTime | Converts a dateTime to a time
  Converter.DateToDateTime | Converts a date to a dateTime
  Converter.DecimalToInteger | Converts a decimal to an integer.
  Converter.DoubleToDecimal | Convers a double to a decimal
  Converter.DoubleToInteger | Converts a double to an integer
  Converter.DownCastingConverter | Converter that checks that a value belonging to a supertype is a valid instance of a subtype, and returns an instance of the subtype
  Converter.DurationToDayTimeDuration | Converts a duration to a dayTimeDuration
  Converter.DurationToYearMonthDuration | Converts a duration to a yearMonthDuration
  Converter.FloatToDecimal | Converts a float to a decimal
  Converter.FloatToInteger | Converts a float to an integer
  Converter.HexBinaryToBase64Binary | Converts hexBinary to base64Binary
  Converter.IdentityConverter | Converter that does nothing - it returns the input unchanged
  Converter.IntegerToDecimal | Converts an integer to a decimal
  Converter.NotationToQName | Converts Notation to QName
  Converter.NumericToBoolean | Converts a numeric value to a boolean
  Converter.NumericToDecimal | Converts any numeric value to a decimal
  Converter.NumericToDouble | Converts any numeric value to a double.
  Converter.NumericToFloat | Converts any numeric value to xs:float
  Converter.NumericToInteger | Converts any numeric value to an integer.
  Converter.PromoterToDouble | Converter that implements the promotion rules to a required type of xs:double
  Converter.PromoterToFloat | Converter that implements the promotion rules to a required type of xs:float
  Converter.QNameToNotation | Converts QName to Notation
  Converter.ToStringConverter | Converts any value to a string
  Converter.ToUntypedAtomicConverter | Converts any value to untyped atomic
  Converter.TwoPhaseConverter | Converter that operates in two phases, via an intermediate type
  Converter.UnfailingConverter | Specialisation for converters that always succeed
  Converter.UpCastingConverter | Converter that does nothing except change the type annotation of the value.
  ErrorType | This class has a singleton instance which represents the XML Schema 1.1 built-in type xs:error.
  ExternalObjectType | This class represents the type of an external object returned by an extension function, or supplied as an external variable/parameter.
  JavaExternalObjectType | This class represents the type of an external Java object returned by an extension function, or supplied as an external variable/parameter.
  LocalUnionType | A class that represents a union type declared locally, for example using the (Saxon-extension) item-type syntax union(a,b,c), or internally in Java code.
  NumericType | Singleton class representing the class xs:numeric as defined in XPath 3.1: a union type whose members are xs:double, xs:decimal, and xs:float
  SpecificFunctionType | An instance of this class represents a specific function item type, for example function(xs:int) as xs:boolean
  StringConverter | A `Converter` that accepts a string as input.
  StringConverter.StringToAnyURI | Converts string to anyURI
  StringConverter.StringToBase64Binary | Converts string to base64
  StringConverter.StringToBoolean | Converts a string to a boolean
  StringConverter.StringToDate | Converts a string to a date
  StringConverter.StringToDateTime | Converts a string to a dateTime
  StringConverter.StringToDateTimeStamp | Converts a string to a dateTimeStamp
  StringConverter.StringToDayTimeDuration | Converts a string to a dayTimeDuration
  StringConverter.StringToDecimal | Converts a string to an xs:decimal
  StringConverter.StringToDerivedStringSubtype | Converts from xs;string to a user-defined type derived from a built-in subtype of xs:string
  StringConverter.StringToDuration | Converts a string to a duration
  StringConverter.StringToFloat | Converts a string to xs:float
  StringConverter.StringToGDay | Converts a string to a gDay
  StringConverter.StringToGMonth | Converts a string to a gMonth
  StringConverter.StringToGMonthDay | Converts a string to a gMonthDay
  StringConverter.StringToGYear | Converts a string to a gYear
  StringConverter.StringToGYearMonth | Converts a string to a gYearMonth
  StringConverter.StringToHexBinary | Converts a string to hexBinary
  StringConverter.StringToInteger | Converts a string to an integer
  StringConverter.StringToIntegerSubtype | Converts a string to a built-in subtype of integer
  StringConverter.StringToLanguage | Converts from xs:string to xs:language
  StringConverter.StringToName | Converts from xs:string to xs:Name
  StringConverter.StringToNCName | Converts from xs:string to xs:NCName, xs:ID, xs:IDREF, or xs:ENTITY
  StringConverter.StringToNMTOKEN | Converts from xs:string to xs:NMTOKEN
  StringConverter.StringToNonStringDerivedType | Converter from string to a derived type (derived from a type other than xs:string), where the derived type needs to retain the original string for validating against lexical facets such as pattern.
  StringConverter.StringToNormalizedString | Converts from xs:string to xs:normalizedString
  StringConverter.StringToNotation | Converts String to NOTATION
  StringConverter.StringToQName | Converts String to QName
  StringConverter.StringToString | Converts from xs:string or xs:untypedAtomic to xs:String
  StringConverter.StringToStringSubtype | Converts from xs:string to a user-defined type derived directly from xs:string
  StringConverter.StringToTime | Converts a string to a time
  StringConverter.StringToToken | Converts from xs:string to xs:token
  StringConverter.StringToUnionConverter | Converter from string to plain union types
  StringConverter.StringToUntypedAtomic | Converts from xs:string or xs:untypedAtomic to xs:untypedAtomic
  StringConverter.StringToYearMonthDuration | Converts a string to a yearMonthDuration
  StringToDouble | This class converts a string to an xs:double according to the rules in XML Schema 1.0
  Type | This class contains static information about types and methods for constructing type codes.
  TypeHierarchy | This class exists to provide answers to questions about the type hierarchy.
  UType | A UType is a union of primitive (atomic, node, or function) item types.
  ValidationFailure | This exception indicates a failure when validating an instance against a type defined in a schema.
  ValidationParams | This class represents a collection of parameter values for use in schema validation; it defines values for the parameters declared using the saxon:param XSD extension.

- Enum Summary
  Enum | Description
  --- | ---
  Affinity | A set of constants enumerating the possible relationships between one type and another
  AnySimpleType | This class has a singleton instance which represents the XML Schema built-in type xs:anySimpleType
  AnyType | This class has a singleton instance which represents the XML Schema built-in type xs:anyType, also known as the urtype.
  PrimitiveUType |
  SchemaComponent.ValidationStatus |
  Untyped | This class has a singleton instance which represents the complex type xdt:untyped, used for elements that have not been validated.

- Exception Summary
  Exception | Description
  --- | ---
  MissingComponentException | This exception occurs when an attempt is made to dereference a reference from one schema component to another, if the target of the reference cannot be found.
  SchemaException | An exception that identifies an error in reading, parsing, or validating a schema.
  ValidationException | This exception indicates a failure when validating an instance against a type defined in a schema.