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 intRepresents the schema typexs:anyAtomicTypestatic final intRepresents the schema typexs:anySimpleTypestatic final intRepresents the schema type xs:anyTypestatic final intRepresents the schema typexs:anyURIstatic final intRepresents the schema typexs:base64Binarystatic final intRepresents the schema typexs:booleanstatic final intRepresents the schema typexs:bytestatic final intRepresents the schema typexs:datestatic final intRepresents the schema typexs:dateTimestatic final intRepresents the schema typexs:dayTimeDurationstatic final intRepresents the schema typexs:decimalstatic final intRepresents the schema typexs:doublestatic final intRepresents the schema typexs:durationstatic final intRepresents the schema typexs:ENTITIESstatic final intRepresents the schema typexs:ENTITYstatic final intRepresents the schema typexs:floatstatic final intRepresents the schema typexs:gDaystatic final intRepresents the schema typexs:gMonthstatic final intRepresents the schema typexs:gMonthDaystatic final intRepresents the schema typexs:gYearstatic final intRepresents the schema typexs:gYearMonthstatic final intRepresents the schema typexs:hexBinarystatic final intRepresents the schema typexs:IDstatic final intRepresents the schema typexs:IDREFstatic final intRepresents the schema typexs:IDREFS.static final intRepresents the schema typexs:intstatic final intRepresents the schema typexs:integerstatic final intRepresents the schema typexs:languagestatic final intRepresents the schema typexs:longstatic final intRepresents the schema typexs:Namestatic final intRepresents the schema typexs:NCNamestatic final intRepresents the schema typexs:negativeIntegerstatic final intRepresents the schema typexs:NMTokenstatic final intRepresents the schema typexs:NMTOKENSstatic final intRepresents the schema typexs:nonNegativeIntegerstatic final intRepresents the schema typexs:nonPositiveIntegerstatic final intRepresents the schema typexs:normalizedStringstatic final intRepresents the schema typexs:NOTATIONstatic final intRepresents the schema typexs:positiveIntegerstatic final intRepresents the schema typexs:QNamestatic final intRepresents the schema typexs:shortstatic final intRepresents the schema typexs:stringstatic final intRepresents the schema typexs:timestatic final intRepresents the schema typexs:tokenstatic final intRepresents the schema typexs:unsignedBytestatic final intRepresents the schema typexs:unsignedIntstatic final intRepresents the schema typexs:unsignedLongstatic final intRepresents the schema typexs:unsignedShortstatic final intRepresents the schema type xs:untypedstatic final intRepresents the schema typexs:untypedAtomicstatic final intRepresents the schema typexs:yearMonthDurationstatic final intSome atomic type.static final intAttribute nodestatic final intComment nodestatic final intDocument type (the type information represents the type of the document element)static final intDocument node containing a single element node as its child (type information represents type of the element child)static final intDocument node containing a single schema element node as its child (type information represents type of the schema element child)static final intElement nodestatic final intAny kind of itemstatic final intSome node typestatic final intProcessing instruction nodestatic final intSchema attribute nodestatic final intSchema element nodestatic final intText 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 TypeMethodDescriptionbooleanCompares the specified object with this item type for equality.intReturns the base type of the item.intReturns the kind of the item.intReturns 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).inthashCode()Returns a hash code consistent with the definition of the equals method.booleanRepresents whether the item type is an anonymous type in the schema.booleanReturns 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:
getItemOccurrencein interfaceXQSequenceType- Returns:
- int indicating the occurrence indicator
-
toString
String toString()Returns a human-readable implementation-defined string representation of the item type.- Specified by:
toStringin interfaceXQSequenceType- Overrides:
toStringin 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 anullvalue will be returned.- Returns:
QNamefor the name of the element, attribute, or document element node.nullif 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 anullvalue 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:
URIrepresenting the schema location URI of the XMLSchema containing the global element definition or the type definition of the current item.nullin 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 actualQNamevalue returned is implementation defined.- Returns:
- the
QNameof 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:
trueif the item type is an anonymous type in the schema,falseotherwise
-
isElementNillable
boolean isElementNillable()Returns whether the element type is nillable or not.- Returns:
trueif the element type is nillable,falseotherwise
-
getPIName
Returns the name of the processing instruction type. As such the item kind of thisXQItemTypemust beXQITEMKIND_PI.- Returns:
- the name of the processing instruction type.
nullif 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 istrueonly if the argument is an item type object which represents the same XQuery item type.In order to comply with the general contract of
equalsandhashCodeacross different implementations the following algorithm must be used. Returntrueif and only if both objects areXQItemTypeand: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:
equalsin interfaceXQSequenceType- Overrides:
equalsin classObject- Parameters:
o- anXQItemTypeobject representing an XQuery item type- Returns:
trueif the input item type object represents the same XQuery item type,falseotherwise
-
hashCode
int hashCode()Returns a hash code consistent with the definition of the equals method.In order to comply with the general contract of
equalsandhashCodeacross 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:
hashCodein interfaceXQSequenceType- Overrides:
hashCodein classObject- Returns:
- hash code for this item type
-