Package net.sf.saxon.type
Class Type
java.lang.Object
net.sf.saxon.type.Type
- All Implemented Interfaces:
Serializable
This class contains static information about types and methods for constructing type codes.
The class is never instantiated.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Constant denoting any atomic type (the union of all primitive types and types derived from primitive types by restriction or by union)static final BuiltInAtomicType
static final int
static final int
Item type representing the type xs:anyURIstatic final BuiltInAtomicType
static final short
Item type representing an attribute node - attribute()static final int
Item type representing the type xs:base64Binarystatic final BuiltInAtomicType
static final int
Item type representing the type xs:booleanstatic final BuiltInAtomicType
static final int
Item type representing the type xs:bytestatic final short
Item type representing a comment nodestatic final int
Item type representing the type xs:datestatic final int
Item type representing the type xs:dateTimestatic final BuiltInAtomicType
static final BuiltInAtomicType
static final int
Item type representing the type xdt:dayTimeDurationstatic final BuiltInAtomicType
static final int
Item type representing the type xs:decimalstatic final BuiltInAtomicType
static final short
Item type representing a document nodestatic final int
Item type representing the type xs:doublestatic final BuiltInAtomicType
static final int
Item type representing the type xs:durationstatic final BuiltInAtomicType
static final short
Type representing an element node - element()static final short
Item type that matches no items (corresponds to SequenceType empty())static final int
Item type representing the type xs:ENTITYstatic final int
Item type representing the type xs:floatstatic final BuiltInAtomicType
static final int
Item type representing the type xs:gDaystatic final BuiltInAtomicType
static final int
Item type representing the type xs:gMonthstatic final int
Item type representing the type xs:monthDaystatic final BuiltInAtomicType
static final BuiltInAtomicType
static final int
Item type representing the type xs:gYearstatic final int
Item type representing the type xs:gYearMonthstatic final BuiltInAtomicType
static final BuiltInAtomicType
static final int
Item type representing the type xs:hexBinarystatic final BuiltInAtomicType
static final int
Item type representing the type xs:IDstatic final BuiltInAtomicType
static final int
Item type representing the type xs:IDREFstatic final BuiltInAtomicType
static final int
Content type representing the complex type xs:IDREFSstatic final int
Item type representing the type xs:intstatic final int
Item type representing the type xs:integerstatic final BuiltInAtomicType
static final short
An item type that matches any itemstatic final ItemType
static final int
Item type representing the type xs:languagestatic final int
Item type representing the type xs:longstatic final short
static final int
Item type representing the type xs:NAMEstatic final short
Item type representing a namespace nodestatic final int
Item type representing the type xs:NCNAMEstatic final BuiltInAtomicType
static final int
Item type representing the type xs:negativeIntegerstatic final int
Item type representing the type xs:NMTOKENstatic final int
Content type representing the complex type xs:NMTOKENSstatic final short
An item type that matches any nodestatic final ItemType
static final int
Item type representing the type xs:nonNegativeIntegerstatic final int
Item type representing the type xs:nonPositiveIntegerstatic final int
Item type representing the type xs:normalizedStringstatic final int
Item type representing the type xs:NOTATIONstatic final BuiltInAtomicType
static final int
Constant denoting any numeric type (the union of float, double, and decimal)static final BuiltInAtomicType
static final int
Constant representing the type of an external object (for use by extension functions)static final short
Dummy node kind used in the tiny tree to contain a parent pointerstatic final int
Item type representing the type xs:positiveIntegerstatic final short
Item type representing a processing-instruction nodestatic final int
Item type representing the type xs:QNamestatic final BuiltInAtomicType
static final int
Item type representing the type xs:shortstatic final short
Dummy node kind used in the tiny tree to mark the end of the treestatic final int
Constants representing primitive data types defined in Schema Part 2static final BuiltInAtomicType
static final short
Item type representing a text node - text()static final int
Item type representing the type xs:timestatic final BuiltInAtomicType
static final int
Item type representing the type xs:tokenstatic final int
Item type representing the type xs:unsignedBytestatic final int
Item type representing the type xs:unsignedIntstatic final int
Item type representing the type xs:unsignedLongstatic final int
Item type representing the type xs:unsignedShortstatic final int
Item type representing the type xdt:untypedAtomic (the type of the content of a schema-less node)static final BuiltInAtomicType
static final short
Item type representing a text node stored in the tiny tree as compressed whitespacestatic final int
Item type representing the type xdt:yearMonthDurationstatic final BuiltInAtomicType
-
Method Summary
Modifier and TypeMethodDescriptionstatic final String
displayTypeName
(Item item) Output (for diagnostics) a representation of the type of an item.static ItemType
getBuiltInItemType
(String namespace, String localName) Get the SimpleType object for a built-in simple type codestatic final ItemType
getCommonSuperType
(ItemType t1, ItemType t2, TypeHierarchy th) Get a type that is a common supertype of two given typesstatic ItemType
getItemType
(Item item, TypeHierarchy th) Get the ItemType of an Itemstatic boolean
isComparable
(int t1, int t2, boolean ordered) Determine whether two primitive atomic types are comparablestatic boolean
isNodeType
(ItemType type) Test whether a given type is (some subtype of) node()static boolean
isNumericPrimitiveType
(int fp) Test whether the supplied type, which must be a primitive type, is one of the numeric primitive typesstatic boolean
Test whether the supplied type, which must be a primitive type, is one of the numeric primitive typesstatic boolean
isOrdered
(int type) Determine whether a primitive type is ordered.static boolean
isPrimitiveType
(int code) Determine whether this type is a primitive type.static int
Get the relationship of two schema types to each other
-
Field Details
-
ELEMENT
public static final short ELEMENTType representing an element node - element()- See Also:
-
ATTRIBUTE
public static final short ATTRIBUTEItem type representing an attribute node - attribute()- See Also:
-
TEXT
public static final short TEXTItem type representing a text node - text()- See Also:
-
WHITESPACE_TEXT
public static final short WHITESPACE_TEXTItem type representing a text node stored in the tiny tree as compressed whitespace- See Also:
-
PROCESSING_INSTRUCTION
public static final short PROCESSING_INSTRUCTIONItem type representing a processing-instruction node- See Also:
-
COMMENT
public static final short COMMENTItem type representing a comment node- See Also:
-
DOCUMENT
public static final short DOCUMENTItem type representing a document node- See Also:
-
NAMESPACE
public static final short NAMESPACEItem type representing a namespace node- See Also:
-
STOPPER
public static final short STOPPERDummy node kind used in the tiny tree to mark the end of the tree- See Also:
-
PARENT_POINTER
public static final short PARENT_POINTERDummy node kind used in the tiny tree to contain a parent pointer- See Also:
-
NODE
public static final short NODEAn item type that matches any node- See Also:
-
NODE_TYPE
-
ITEM
public static final short ITEMAn item type that matches any item- See Also:
-
ITEM_TYPE
-
MAX_NODE_TYPE
public static final short MAX_NODE_TYPE- See Also:
-
EMPTY
public static final short EMPTYItem type that matches no items (corresponds to SequenceType empty())- See Also:
-
ANY_ATOMIC
public static final int ANY_ATOMICConstant denoting any atomic type (the union of all primitive types and types derived from primitive types by restriction or by union)- See Also:
-
NUMBER
public static final int NUMBERConstant denoting any numeric type (the union of float, double, and decimal)- See Also:
-
STRING
public static final int STRINGConstants representing primitive data types defined in Schema Part 2- See Also:
-
BOOLEAN
public static final int BOOLEANItem type representing the type xs:boolean- See Also:
-
DECIMAL
public static final int DECIMALItem type representing the type xs:decimal- See Also:
-
FLOAT
public static final int FLOATItem type representing the type xs:float- See Also:
-
DOUBLE
public static final int DOUBLEItem type representing the type xs:double- See Also:
-
DURATION
public static final int DURATIONItem type representing the type xs:duration- See Also:
-
DATE_TIME
public static final int DATE_TIMEItem type representing the type xs:dateTime- See Also:
-
TIME
public static final int TIMEItem type representing the type xs:time- See Also:
-
DATE
public static final int DATEItem type representing the type xs:date- See Also:
-
G_YEAR_MONTH
public static final int G_YEAR_MONTHItem type representing the type xs:gYearMonth- See Also:
-
G_YEAR
public static final int G_YEARItem type representing the type xs:gYear- See Also:
-
G_MONTH_DAY
public static final int G_MONTH_DAYItem type representing the type xs:monthDay- See Also:
-
G_DAY
public static final int G_DAYItem type representing the type xs:gDay- See Also:
-
G_MONTH
public static final int G_MONTHItem type representing the type xs:gMonth- See Also:
-
HEX_BINARY
public static final int HEX_BINARYItem type representing the type xs:hexBinary- See Also:
-
BASE64_BINARY
public static final int BASE64_BINARYItem type representing the type xs:base64Binary- See Also:
-
ANY_URI
public static final int ANY_URIItem type representing the type xs:anyURI- See Also:
-
QNAME
public static final int QNAMEItem type representing the type xs:QName- See Also:
-
NOTATION
public static final int NOTATIONItem type representing the type xs:NOTATION- See Also:
-
UNTYPED_ATOMIC
public static final int UNTYPED_ATOMICItem type representing the type xdt:untypedAtomic (the type of the content of a schema-less node)- See Also:
-
ANY_SIMPLE_TYPE
public static final int ANY_SIMPLE_TYPE- See Also:
-
OBJECT
public static final int OBJECTConstant representing the type of an external object (for use by extension functions)- See Also:
-
INTEGER
public static final int INTEGERItem type representing the type xs:integer- See Also:
-
NON_POSITIVE_INTEGER
public static final int NON_POSITIVE_INTEGERItem type representing the type xs:nonPositiveInteger- See Also:
-
NEGATIVE_INTEGER
public static final int NEGATIVE_INTEGERItem type representing the type xs:negativeInteger- See Also:
-
LONG
public static final int LONGItem type representing the type xs:long- See Also:
-
INT
public static final int INTItem type representing the type xs:int- See Also:
-
SHORT
public static final int SHORTItem type representing the type xs:short- See Also:
-
BYTE
public static final int BYTEItem type representing the type xs:byte- See Also:
-
NON_NEGATIVE_INTEGER
public static final int NON_NEGATIVE_INTEGERItem type representing the type xs:nonNegativeInteger- See Also:
-
POSITIVE_INTEGER
public static final int POSITIVE_INTEGERItem type representing the type xs:positiveInteger- See Also:
-
UNSIGNED_LONG
public static final int UNSIGNED_LONGItem type representing the type xs:unsignedLong- See Also:
-
UNSIGNED_INT
public static final int UNSIGNED_INTItem type representing the type xs:unsignedInt- See Also:
-
UNSIGNED_SHORT
public static final int UNSIGNED_SHORTItem type representing the type xs:unsignedShort- See Also:
-
UNSIGNED_BYTE
public static final int UNSIGNED_BYTEItem type representing the type xs:unsignedByte- See Also:
-
NORMALIZED_STRING
public static final int NORMALIZED_STRINGItem type representing the type xs:normalizedString- See Also:
-
TOKEN
public static final int TOKENItem type representing the type xs:token- See Also:
-
LANGUAGE
public static final int LANGUAGEItem type representing the type xs:language- See Also:
-
NMTOKEN
public static final int NMTOKENItem type representing the type xs:NMTOKEN- See Also:
-
NMTOKENS
public static final int NMTOKENSContent type representing the complex type xs:NMTOKENS- See Also:
-
NAME
public static final int NAMEItem type representing the type xs:NAME- See Also:
-
NCNAME
public static final int NCNAMEItem type representing the type xs:NCNAME- See Also:
-
ID
public static final int IDItem type representing the type xs:ID- See Also:
-
IDREF
public static final int IDREFItem type representing the type xs:IDREF- See Also:
-
IDREFS
public static final int IDREFSContent type representing the complex type xs:IDREFS- See Also:
-
ENTITY
public static final int ENTITYItem type representing the type xs:ENTITY- See Also:
-
YEAR_MONTH_DURATION
public static final int YEAR_MONTH_DURATIONItem type representing the type xdt:yearMonthDuration- See Also:
-
DAY_TIME_DURATION
public static final int DAY_TIME_DURATIONItem type representing the type xdt:dayTimeDuration- See Also:
-
UNTYPED_ATOMIC_TYPE
-
ANY_ATOMIC_TYPE
-
YEAR_MONTH_DURATION_TYPE
-
DAY_TIME_DURATION_TYPE
-
STRING_TYPE
-
BOOLEAN_TYPE
-
DECIMAL_TYPE
-
FLOAT_TYPE
-
DOUBLE_TYPE
-
DURATION_TYPE
-
DATE_TIME_TYPE
-
TIME_TYPE
-
DATE_TYPE
-
G_YEAR_MONTH_TYPE
-
G_YEAR_TYPE
-
G_MONTH_DAY_TYPE
-
G_DAY_TYPE
-
G_MONTH_TYPE
-
HEX_BINARY_TYPE
-
BASE64_BINARY_TYPE
-
ANY_URI_TYPE
-
QNAME_TYPE
-
NOTATION_TYPE
-
INTEGER_TYPE
-
ID_TYPE
-
IDREF_TYPE
-
NCNAME_TYPE
-
NUMBER_TYPE
-
-
Method Details
-
isNodeType
Test whether a given type is (some subtype of) node()- Parameters:
type
- The type to be tested- Returns:
- true if the item type is node() or a subtype of node()
-
getItemType
Get the ItemType of an Item -
displayTypeName
Output (for diagnostics) a representation of the type of an item. This does not have to be the most specific type -
getBuiltInItemType
Get the SimpleType object for a built-in simple type code- Returns:
- the SimpleType, or null if not found
-
schemaTypeRelationship
Get the relationship of two schema types to each other -
getCommonSuperType
Get a type that is a common supertype of two given types- Parameters:
t1
- the first item typet2
- the second item typeth
-- Returns:
- the item type that is a supertype of both the supplied item types
-
isPrimitiveType
public static boolean isPrimitiveType(int code) Determine whether this type is a primitive type. The primitive types are the 19 primitive types of XML Schema, plus xs:integer, xdt:dayTimeDuration and xdt:yearMonthDuration; xdt:untypedAtomic; the 7 node kinds; and all supertypes of these (item(), node(), xdt:anyAtomicType, xdt:number, ...)- Parameters:
code
- the item type code to be tested- Returns:
- true if the type is considered primitive under the above rules
-
isComparable
public static boolean isComparable(int t1, int t2, boolean ordered) Determine whether two primitive atomic types are comparable- Parameters:
t1
- the first type to compared. This must be a primitive atomic type as defined byItemType.getPrimitiveType()
t2
- the second type to compared. This must be a primitive atomic type as defined byItemType.getPrimitiveType()
ordered
- true if testing for an ordering comparison (lt, gt, le, ge). False if testing for an equality comparison (eq, ne)- Returns:
- true if the types are comparable, as defined by the rules of the "eq" operator
-
isOrdered
public static boolean isOrdered(int type) Determine whether a primitive type is ordered. Note that the rules for this differ between XPath and XML Schema: these are the XPath rules.- Parameters:
type
- the primitive item type being tested- Returns:
- true if the types are potentially comparable. For abstract types (type=ATOMIC) we give the benefit of the doubt and return true.
-
isNumericPrimitiveType
Test whether the supplied type, which must be a primitive type, is one of the numeric primitive types- Parameters:
t
- the type being tested- Returns:
- true if the type is integer, double, float, decimal, or the abstract type "numeric"
-
isNumericPrimitiveType
public static boolean isNumericPrimitiveType(int fp) Test whether the supplied type, which must be a primitive type, is one of the numeric primitive types- Parameters:
fp
- the fingerprint of the type being tested- Returns:
- true if the type is integer, double, float, decimal, or the abstract type "numeric"
-