Interface XQItemType
- All Superinterfaces:
XQSequenceType
- All Known Implementing Classes:
SaxonXQItemType
XQItemType
interface represents an item type as defined in
XQuery 1.0: An XML Query language.
The XQItemType
extends the XQSequenceType
but
restricts the occurrance indicator to be exactly one. This derivation allows passing
an item type wherever a sequence type is expected, but not the other way.
The XQItemType
interface contains methods to represent
information about the following aspects of an item type:
- The kind of the item - one of
XQITEMKIND_*
constants - The base type of the item - one of the
XQBASETYPE_*
constants. For atomic types this is the closest matching built-in XML Schema type, for element and attributes the closest matching built-in XML Schema type this node is based on. - Name of the node, if any
- Type name, if any. If present, then also whether the typename is an anonymous type
- XML Schema URI associated with the type, if any
- The nillability characteristics, if any
An instance of the XQItemType
is a standalone
object that is independant of the XQConnection
and
any XQuery static or dynamic context.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Represents the schema typexs:anyAtomicType
static final int
Represents the schema typexs:anySimpleType
static final int
Represents the schema type xs:anyTypestatic final int
Represents the schema typexs:anyURI
static final int
Represents the schema typexs:base64Binary
static final int
Represents the schema typexs:boolean
static final int
Represents the schema typexs:byte
static final int
Represents the schema typexs:date
static final int
Represents the schema typexs:dateTime
static final int
Represents the schema typexs:dayTimeDuration
static final int
Represents the schema typexs:decimal
static final int
Represents the schema typexs:double
static final int
Represents the schema typexs:duration
static final int
Represents the schema typexs:ENTITIES
static final int
Represents the schema typexs:ENTITY
static final int
Represents the schema typexs:float
static final int
Represents the schema typexs:gDay
static final int
Represents the schema typexs:gMonth
static final int
Represents the schema typexs:gMonthDay
static final int
Represents the schema typexs:gYear
static final int
Represents the schema typexs:gYearMonth
static final int
Represents the schema typexs:hexBinary
static final int
Represents the schema typexs:ID
static final int
Represents the schema typexs:IDREF
static final int
Represents the schema typexs:IDREFS
.static final int
Represents the schema typexs:int
static final int
Represents the schema typexs:integer
static final int
Represents the schema typexs:language
static final int
Represents the schema typexs:long
static final int
Represents the schema typexs:Name
static final int
Represents the schema typexs:NCName
static final int
Represents the schema typexs:negativeInteger
static final int
Represents the schema typexs:NMToken
static final int
Represents the schema typexs:NMTOKENS
static final int
Represents the schema typexs:nonNegativeInteger
static final int
Represents the schema typexs:nonPositiveInteger
static final int
Represents the schema typexs:normalizedString
static final int
Represents the schema typexs:NOTATION
static final int
Represents the schema typexs:positiveInteger
static final int
Represents the schema typexs:QName
static final int
Represents the schema typexs:short
static final int
Represents the schema typexs:string
static final int
Represents the schema typexs:time
static final int
Represents the schema typexs:token
static final int
Represents the schema typexs:unsignedByte
static final int
Represents the schema typexs:unsignedInt
static final int
Represents the schema typexs:unsignedLong
static final int
Represents the schema typexs:unsignedShort
static final int
Represents the schema type xs:untypedstatic final int
Represents the schema typexs:untypedAtomic
static final int
Represents the schema typexs:yearMonthDuration
static final int
Some atomic type.static final int
Attribute nodestatic final int
Comment nodestatic final int
Document type (the type information represents the type of the document element)static final int
Document node containing a single element node as its child (type information represents type of the element child)static final int
Document node containing a single schema element node as its child (type information represents type of the schema element child)static final int
Element nodestatic final int
Any kind of itemstatic final int
Some node typestatic final int
Processing instruction nodestatic final int
Schema attribute nodestatic final int
Schema element nodestatic final int
Text nodeFields inherited from interface javax.xml.xquery.XQSequenceType
OCC_EMPTY, OCC_EXACTLY_ONE, OCC_ONE_OR_MORE, OCC_ZERO_OR_MORE, OCC_ZERO_OR_ONE
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares the specified object with this item type for equality.int
Returns the base type of the item.int
Returns the kind of the item.int
Returns the occurrence indicator for the item type.Returns the name of the node in case the item kind is anXQITEMKIND_DOCUMENT_ELEMENT
,XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
,XQITEMKIND_ELEMENT
,XQITEMKIND_SCHEMA_ELEMENT
,XQITEMKIND_ATTRIBUTE
, orXQITEMKIND_SCHEMA_ATTRIBUTE
.Returns the name of the processing instruction type.Returns the schema location URI of the schema that contains the item's element or type definition.Represents a type name (global or local).int
hashCode()
Returns a hash code consistent with the definition of the equals method.boolean
Represents whether the item type is an anonymous type in the schema.boolean
Returns whether the element type is nillable or not.toString()
Returns a human-readable implementation-defined string representation of the item type.Methods inherited from interface javax.xml.xquery.XQSequenceType
getItemType
-
Field Details
-
XQITEMKIND_ATOMIC
static final int XQITEMKIND_ATOMICSome atomic type.- See Also:
-
XQITEMKIND_ATTRIBUTE
static final int XQITEMKIND_ATTRIBUTEAttribute node- See Also:
-
XQITEMKIND_COMMENT
static final int XQITEMKIND_COMMENTComment node- See Also:
-
XQITEMKIND_DOCUMENT
static final int XQITEMKIND_DOCUMENTDocument type (the type information represents the type of the document element)- See Also:
-
XQITEMKIND_DOCUMENT_ELEMENT
static final int XQITEMKIND_DOCUMENT_ELEMENTDocument node containing a single element node as its child (type information represents type of the element child)- See Also:
-
XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
static final int XQITEMKIND_DOCUMENT_SCHEMA_ELEMENTDocument node containing a single schema element node as its child (type information represents type of the schema element child)- See Also:
-
XQITEMKIND_ELEMENT
static final int XQITEMKIND_ELEMENTElement node- See Also:
-
XQITEMKIND_ITEM
static final int XQITEMKIND_ITEMAny kind of item- See Also:
-
XQITEMKIND_NODE
static final int XQITEMKIND_NODESome node type- See Also:
-
XQITEMKIND_PI
static final int XQITEMKIND_PIProcessing instruction node- See Also:
-
XQITEMKIND_TEXT
static final int XQITEMKIND_TEXTText node- See Also:
-
XQITEMKIND_SCHEMA_ELEMENT
static final int XQITEMKIND_SCHEMA_ELEMENTSchema element node- See Also:
-
XQITEMKIND_SCHEMA_ATTRIBUTE
static final int XQITEMKIND_SCHEMA_ATTRIBUTESchema attribute node- See Also:
-
XQBASETYPE_UNTYPED
static final int XQBASETYPE_UNTYPEDRepresents the schema type xs:untyped- See Also:
-
XQBASETYPE_ANYTYPE
static final int XQBASETYPE_ANYTYPERepresents the schema type xs:anyType- See Also:
-
XQBASETYPE_ANYSIMPLETYPE
static final int XQBASETYPE_ANYSIMPLETYPERepresents the schema typexs:anySimpleType
- See Also:
-
XQBASETYPE_ANYATOMICTYPE
static final int XQBASETYPE_ANYATOMICTYPERepresents the schema typexs:anyAtomicType
- See Also:
-
XQBASETYPE_UNTYPEDATOMIC
static final int XQBASETYPE_UNTYPEDATOMICRepresents the schema typexs:untypedAtomic
- See Also:
-
XQBASETYPE_DAYTIMEDURATION
static final int XQBASETYPE_DAYTIMEDURATIONRepresents the schema typexs:dayTimeDuration
- See Also:
-
XQBASETYPE_YEARMONTHDURATION
static final int XQBASETYPE_YEARMONTHDURATIONRepresents the schema typexs:yearMonthDuration
- See Also:
-
XQBASETYPE_ANYURI
static final int XQBASETYPE_ANYURIRepresents the schema typexs:anyURI
- See Also:
-
XQBASETYPE_BASE64BINARY
static final int XQBASETYPE_BASE64BINARYRepresents the schema typexs:base64Binary
- See Also:
-
XQBASETYPE_BOOLEAN
static final int XQBASETYPE_BOOLEANRepresents the schema typexs:boolean
- See Also:
-
XQBASETYPE_DATE
static final int XQBASETYPE_DATERepresents the schema typexs:date
- See Also:
-
XQBASETYPE_INT
static final int XQBASETYPE_INTRepresents the schema typexs:int
- See Also:
-
XQBASETYPE_INTEGER
static final int XQBASETYPE_INTEGERRepresents the schema typexs:integer
- See Also:
-
XQBASETYPE_SHORT
static final int XQBASETYPE_SHORTRepresents the schema typexs:short
- See Also:
-
XQBASETYPE_LONG
static final int XQBASETYPE_LONGRepresents the schema typexs:long
- See Also:
-
XQBASETYPE_DATETIME
static final int XQBASETYPE_DATETIMERepresents the schema typexs:dateTime
- See Also:
-
XQBASETYPE_DECIMAL
static final int XQBASETYPE_DECIMALRepresents the schema typexs:decimal
- See Also:
-
XQBASETYPE_DOUBLE
static final int XQBASETYPE_DOUBLERepresents the schema typexs:double
- See Also:
-
XQBASETYPE_DURATION
static final int XQBASETYPE_DURATIONRepresents the schema typexs:duration
- See Also:
-
XQBASETYPE_FLOAT
static final int XQBASETYPE_FLOATRepresents the schema typexs:float
- See Also:
-
XQBASETYPE_GDAY
static final int XQBASETYPE_GDAYRepresents the schema typexs:gDay
- See Also:
-
XQBASETYPE_GMONTH
static final int XQBASETYPE_GMONTHRepresents the schema typexs:gMonth
- See Also:
-
XQBASETYPE_GMONTHDAY
static final int XQBASETYPE_GMONTHDAYRepresents the schema typexs:gMonthDay
- See Also:
-
XQBASETYPE_GYEAR
static final int XQBASETYPE_GYEARRepresents the schema typexs:gYear
- See Also:
-
XQBASETYPE_GYEARMONTH
static final int XQBASETYPE_GYEARMONTHRepresents the schema typexs:gYearMonth
- See Also:
-
XQBASETYPE_HEXBINARY
static final int XQBASETYPE_HEXBINARYRepresents the schema typexs:hexBinary
- See Also:
-
XQBASETYPE_NOTATION
static final int XQBASETYPE_NOTATIONRepresents the schema typexs:NOTATION
- See Also:
-
XQBASETYPE_QNAME
static final int XQBASETYPE_QNAMERepresents the schema typexs:QName
- See Also:
-
XQBASETYPE_STRING
static final int XQBASETYPE_STRINGRepresents the schema typexs:string
- See Also:
-
XQBASETYPE_TIME
static final int XQBASETYPE_TIMERepresents the schema typexs:time
- See Also:
-
XQBASETYPE_BYTE
static final int XQBASETYPE_BYTERepresents the schema typexs:byte
- See Also:
-
XQBASETYPE_NONPOSITIVE_INTEGER
static final int XQBASETYPE_NONPOSITIVE_INTEGERRepresents the schema typexs:nonPositiveInteger
- See Also:
-
XQBASETYPE_NONNEGATIVE_INTEGER
static final int XQBASETYPE_NONNEGATIVE_INTEGERRepresents the schema typexs:nonNegativeInteger
- See Also:
-
XQBASETYPE_NEGATIVE_INTEGER
static final int XQBASETYPE_NEGATIVE_INTEGERRepresents the schema typexs:negativeInteger
- See Also:
-
XQBASETYPE_POSITIVE_INTEGER
static final int XQBASETYPE_POSITIVE_INTEGERRepresents the schema typexs:positiveInteger
- See Also:
-
XQBASETYPE_UNSIGNED_LONG
static final int XQBASETYPE_UNSIGNED_LONGRepresents the schema typexs:unsignedLong
- See Also:
-
XQBASETYPE_UNSIGNED_INT
static final int XQBASETYPE_UNSIGNED_INTRepresents the schema typexs:unsignedInt
- See Also:
-
XQBASETYPE_UNSIGNED_SHORT
static final int XQBASETYPE_UNSIGNED_SHORTRepresents the schema typexs:unsignedShort
- See Also:
-
XQBASETYPE_UNSIGNED_BYTE
static final int XQBASETYPE_UNSIGNED_BYTERepresents the schema typexs:unsignedByte
- See Also:
-
XQBASETYPE_NORMALIZED_STRING
static final int XQBASETYPE_NORMALIZED_STRINGRepresents the schema typexs:normalizedString
- See Also:
-
XQBASETYPE_TOKEN
static final int XQBASETYPE_TOKENRepresents the schema typexs:token
- See Also:
-
XQBASETYPE_LANGUAGE
static final int XQBASETYPE_LANGUAGERepresents the schema typexs:language
- See Also:
-
XQBASETYPE_NAME
static final int XQBASETYPE_NAMERepresents the schema typexs:Name
- See Also:
-
XQBASETYPE_NCNAME
static final int XQBASETYPE_NCNAMERepresents the schema typexs:NCName
- See Also:
-
XQBASETYPE_NMTOKEN
static final int XQBASETYPE_NMTOKENRepresents the schema typexs:NMToken
- See Also:
-
XQBASETYPE_ID
static final int XQBASETYPE_IDRepresents the schema typexs:ID
- See Also:
-
XQBASETYPE_IDREF
static final int XQBASETYPE_IDREFRepresents the schema typexs:IDREF
- See Also:
-
XQBASETYPE_ENTITY
static final int XQBASETYPE_ENTITYRepresents the schema typexs:ENTITY
- See Also:
-
XQBASETYPE_IDREFS
static final int XQBASETYPE_IDREFSRepresents the schema typexs:IDREFS
. Valid only if the item kind isXQITEMKIND_ELEMENT
,XQITEMKIND_DOCUMENT_ELEMENT
, orXQITEMKIND_ATTRIBUTE
- See Also:
-
XQBASETYPE_ENTITIES
static final int XQBASETYPE_ENTITIESRepresents the schema typexs:ENTITIES
- See Also:
-
XQBASETYPE_NMTOKENS
static final int XQBASETYPE_NMTOKENSRepresents the schema typexs:NMTOKENS
- See Also:
-
-
Method Details
-
getBaseType
Returns the base type of the item. One of theXQBASETYPE_*
constants.XQJ defines a constant for each of the built-in schema types defined in XML Schema. For atomic types this is the closest matching built-in XML Schema type, for element and attributes the closest matching built-in XML Schema type this node is based on.
- Returns:
- int one of the
XQBASETYPE_*
constants indicating the basic type of the item - Throws:
XQException
- if the item kind is not one of:XQITEMKIND_DOCUMENT_ELEMENT
,XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
,XQITEMKIND_ELEMENT
,XQITEMKIND_SCHEMA_ELEMENT
,XQITEMKIND_ATTRIBUTE
,XQITEMKIND_SCHEMA_ATTRIBUTE
, orXQITEMKIND_ATOMIC
-
getItemKind
int getItemKind()Returns the kind of the item. One of theXQITEMKIND_*
constants.- Returns:
- int one of the
XQITEMKIND_*
constants indicating the basic kind of the item
-
getItemOccurrence
int getItemOccurrence()Returns the occurrence indicator for the item type. This method will always return the valueXQSequenceType.OCC_EXACTLY_ONE
.- Specified by:
getItemOccurrence
in interfaceXQSequenceType
- Returns:
- int indicating the occurrence indicator
-
toString
String toString()Returns a human-readable implementation-defined string representation of the item type.- Specified by:
toString
in interfaceXQSequenceType
- Overrides:
toString
in classObject
- Returns:
- String a string representation of the item type
-
getNodeName
Returns the name of the node in case the item kind is anXQITEMKIND_DOCUMENT_ELEMENT
,XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
,XQITEMKIND_ELEMENT
,XQITEMKIND_SCHEMA_ELEMENT
,XQITEMKIND_ATTRIBUTE
, orXQITEMKIND_SCHEMA_ATTRIBUTE
.For example, in the case of a type for
element "foo"
this will return theQName foo
. For wildcard entries anull
value will be returned.- Returns:
QName
for the name of the element, attribute, or document element node.null
if it is a wildcard- Throws:
XQException
- if the item kind is not one of:XQITEMKIND_DOCUMENT_ELEMENT
,XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
,XQITEMKIND_ELEMENT
,XQITEMKIND_SCHEMA_ELEMENT
,XQITEMKIND_ATTRIBUTE
, orXQITEMKIND_SCHEMA_ATTRIBUTE
-
getSchemaURI
URI getSchemaURI()Returns the schema location URI of the schema that contains the item's element or type definition. This method is implementation-definied and an implementation will return anull
value if it does not support retrieving the schema location URI.If the item corresponds to a validated global element in a schema, the result will be the schema location URI to the XMLSchema containing the element definition. Otherwise if the item is a schema validated node, the result will be the schema location URI of the XMLSchema containing the type definition of that node. If the item is not schema validated, the result is
null
- Returns:
URI
representing the schema location URI of the XMLSchema containing the global element definition or the type definition of the current item.null
in case the item is not schema validated or if the implementation does not support retrieving the schema URI.
-
getTypeName
Represents a type name (global or local). This can be used to represent specific type name such as, element foo of type hatsize. The schema type name is represented as a singleQName
. If the return type is an anonymous type, the actualQName
value returned is implementation defined.- Returns:
- the
QName
of the schema type in case of a user defined or anonoymous types. For a built-in type, returns a predefined type name as QName (e.g.xs:anyType
,xs:decimal
, etc). Cannot benull
- Throws:
XQException
- if the item kind is not one of:XQITEMKIND_DOCUMENT_ELEMENT
,XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
,XQITEMKIND_ATOMIC
,XQITEMKIND_ELEMENT
,XQITEMKIND_SCHEMA_ELEMENT
,XQITEMKIND_ATTRIBUTE
, orXQITEMKIND_SCHEMA_ATTRIBUTE
-
isAnonymousType
boolean isAnonymousType()Represents whether the item type is an anonymous type in the schema.- Returns:
true
if the item type is an anonymous type in the schema,false
otherwise
-
isElementNillable
boolean isElementNillable()Returns whether the element type is nillable or not.- Returns:
true
if the element type is nillable,false
otherwise
-
getPIName
Returns the name of the processing instruction type. As such the item kind of thisXQItemType
must beXQITEMKIND_PI
.- Returns:
- the name of the processing instruction type.
null
if it is a wildcard - Throws:
XQException
- if the item kind is notXQITEMKIND_PI
-
equals
Compares the specified object with this item type for equality. The result istrue
only if the argument is an item type object which represents the same XQuery item type.In order to comply with the general contract of
equals
andhashCode
across different implementations the following algorithm must be used. Returntrue
if and only if both objects areXQItemType
and:getItemKind()
is equal- if
getBaseType()
is supported for the item kind, it must be equal - if
getNodeName()
is supported for the item kind, it must be equal getSchemaURI()
is equal- if
getTypeName()
is supported for the item kind, it must be equal isAnonymousType()
is equalisElementNillable()
is equal- if
getPIName()
is supported for the item kind, it must be equal
- Specified by:
equals
in interfaceXQSequenceType
- Overrides:
equals
in classObject
- Parameters:
o
- anXQItemType
object representing an XQuery item type- Returns:
true
if the input item type object represents the same XQuery item type,false
otherwise
-
hashCode
int hashCode()Returns a hash code consistent with the definition of the equals method.In order to comply with the general contract of
equals
andhashCode
across different implementations the following algorithm must be used:hashCode = this.getItemKind(); if this.getSchemaURI != null hashCode = 31*hashCode + this.getSchemaURI().hashCode(); if this.getBaseType() is supported for the item kind hashCode = 31*hashCode + this.getbaseType(); if this.getNodeName () is supported for the item kind and this.getNodeName() != null hashCode = 31*hashCode + this.getNodeName().hashCode() if this.getTypeName () is supported for the item kind hashCode = 31*hashCode + this.getTypeName().hashCode(); if this.getPIName () is supported for the item kind and this.getPIName () != null hashCode = 31*hashCode + this.getPIName().hashCode();
- Specified by:
hashCode
in interfaceXQSequenceType
- Overrides:
hashCode
in classObject
- Returns:
- hash code for this item type
-