javax.xml.xquery

Interface XQItemType

public interface XQItemType extends XQSequenceType

The 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: An instance of the XQItemType is a standalone object that is independant of the XQConnection and any XQuery static or dynamic context.
Field Summary
static intXQBASETYPE_ANYATOMICTYPE
Represents the schema type xs:anyAtomicType
static intXQBASETYPE_ANYSIMPLETYPE
Represents the schema type xs:anySimpleType
static intXQBASETYPE_ANYTYPE
Represents the schema type xs:anyType
static intXQBASETYPE_ANYURI
Represents the schema type xs:anyURI
static intXQBASETYPE_BASE64BINARY
Represents the schema type xs:base64Binary
static intXQBASETYPE_BOOLEAN
Represents the schema type xs:boolean
static intXQBASETYPE_BYTE
Represents the schema type xs:byte
static intXQBASETYPE_DATE
Represents the schema type xs:date
static intXQBASETYPE_DATETIME
Represents the schema type xs:dateTime
static intXQBASETYPE_DAYTIMEDURATION
Represents the schema type xs:dayTimeDuration
static intXQBASETYPE_DECIMAL
Represents the schema type xs:decimal
static intXQBASETYPE_DOUBLE
Represents the schema type xs:double
static intXQBASETYPE_DURATION
Represents the schema type xs:duration
static intXQBASETYPE_ENTITIES
Represents the schema type xs:ENTITIES
static intXQBASETYPE_ENTITY
Represents the schema type xs:ENTITY
static intXQBASETYPE_FLOAT
Represents the schema type xs:float
static intXQBASETYPE_GDAY
Represents the schema type xs:gDay
static intXQBASETYPE_GMONTH
Represents the schema type xs:gMonth
static intXQBASETYPE_GMONTHDAY
Represents the schema type xs:gMonthDay
static intXQBASETYPE_GYEAR
Represents the schema type xs:gYear
static intXQBASETYPE_GYEARMONTH
Represents the schema type xs:gYearMonth
static intXQBASETYPE_HEXBINARY
Represents the schema type xs:hexBinary
static intXQBASETYPE_ID
Represents the schema type xs:ID
static intXQBASETYPE_IDREF
Represents the schema type xs:IDREF
static intXQBASETYPE_IDREFS
Represents the schema type xs:IDREFS.
static intXQBASETYPE_INT
Represents the schema type xs:int
static intXQBASETYPE_INTEGER
Represents the schema type xs:integer
static intXQBASETYPE_LANGUAGE
Represents the schema type xs:language
static intXQBASETYPE_LONG
Represents the schema type xs:long
static intXQBASETYPE_NAME
Represents the schema type xs:Name
static intXQBASETYPE_NCNAME
Represents the schema type xs:NCName
static intXQBASETYPE_NEGATIVE_INTEGER
Represents the schema type xs:negativeInteger
static intXQBASETYPE_NMTOKEN
Represents the schema type xs:NMToken
static intXQBASETYPE_NMTOKENS
Represents the schema type xs:NMTOKENS
static intXQBASETYPE_NONNEGATIVE_INTEGER
Represents the schema type xs:nonNegativeInteger
static intXQBASETYPE_NONPOSITIVE_INTEGER
Represents the schema type xs:nonPositiveInteger
static intXQBASETYPE_NORMALIZED_STRING
Represents the schema type xs:normalizedString
static intXQBASETYPE_NOTATION
Represents the schema type xs:NOTATION
static intXQBASETYPE_POSITIVE_INTEGER
Represents the schema type xs:positiveInteger
static intXQBASETYPE_QNAME
Represents the schema type xs:QName
static intXQBASETYPE_SHORT
Represents the schema type xs:short
static intXQBASETYPE_STRING
Represents the schema type xs:string
static intXQBASETYPE_TIME
Represents the schema type xs:time
static intXQBASETYPE_TOKEN
Represents the schema type xs:token
static intXQBASETYPE_UNSIGNED_BYTE
Represents the schema type xs:unsignedByte
static intXQBASETYPE_UNSIGNED_INT
Represents the schema type xs:unsignedInt
static intXQBASETYPE_UNSIGNED_LONG
Represents the schema type xs:unsignedLong
static intXQBASETYPE_UNSIGNED_SHORT
Represents the schema type xs:unsignedShort
static intXQBASETYPE_UNTYPED
Represents the schema type xs:untyped
static intXQBASETYPE_UNTYPEDATOMIC
Represents the schema type xs:untypedAtomic
static intXQBASETYPE_YEARMONTHDURATION
Represents the schema type xs:yearMonthDuration
static intXQITEMKIND_ATOMIC
Some atomic type.
static intXQITEMKIND_ATTRIBUTE
Attribute node
static intXQITEMKIND_COMMENT
Comment node
static intXQITEMKIND_DOCUMENT
Document type (the type information represents the type of the document element)
static intXQITEMKIND_DOCUMENT_ELEMENT
Document node containing a single element node as its child (type information represents type of the element child)
static intXQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
Document node containing a single schema element node as its child (type information represents type of the schema element child)
static intXQITEMKIND_ELEMENT
Element node
static intXQITEMKIND_ITEM
Any kind of item
static intXQITEMKIND_NODE
Some node type
static intXQITEMKIND_PI
Processing instruction node
static intXQITEMKIND_SCHEMA_ATTRIBUTE
Schema attribute node
static intXQITEMKIND_SCHEMA_ELEMENT
Schema element node
static intXQITEMKIND_TEXT
Text node
Method Summary
booleanequals(Object o)
Compares the specified object with this item type for equality.
intgetBaseType()
Returns the base type of the item.
intgetItemKind()
Returns the kind of the item.
intgetItemOccurrence()
Returns the occurrence indicator for the item type.
QNamegetNodeName()
Returns the name of the node in case the item kind is an XQITEMKIND_DOCUMENT_ELEMENT, XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT, XQITEMKIND_ELEMENT, XQITEMKIND_SCHEMA_ELEMENT, XQITEMKIND_ATTRIBUTE, or XQITEMKIND_SCHEMA_ATTRIBUTE.
StringgetPIName()
Returns the name of the processing instruction type.
URIgetSchemaURI()
Returns the schema location URI of the schema that contains the item's element or type definition.
QNamegetTypeName()
Represents a type name (global or local).
inthashCode()
Returns a hash code consistent with the definition of the equals method.
booleanisAnonymousType()
Represents whether the item type is an anonymous type in the schema.
booleanisElementNillable()
Returns whether the element type is nillable or not.
StringtoString()
Returns a human-readable implementation-defined string representation of the item type.

Field Detail

XQBASETYPE_ANYATOMICTYPE

public static final int XQBASETYPE_ANYATOMICTYPE
Represents the schema type xs:anyAtomicType

XQBASETYPE_ANYSIMPLETYPE

public static final int XQBASETYPE_ANYSIMPLETYPE
Represents the schema type xs:anySimpleType

XQBASETYPE_ANYTYPE

public static final int XQBASETYPE_ANYTYPE
Represents the schema type xs:anyType

XQBASETYPE_ANYURI

public static final int XQBASETYPE_ANYURI
Represents the schema type xs:anyURI

XQBASETYPE_BASE64BINARY

public static final int XQBASETYPE_BASE64BINARY
Represents the schema type xs:base64Binary

XQBASETYPE_BOOLEAN

public static final int XQBASETYPE_BOOLEAN
Represents the schema type xs:boolean

XQBASETYPE_BYTE

public static final int XQBASETYPE_BYTE
Represents the schema type xs:byte

XQBASETYPE_DATE

public static final int XQBASETYPE_DATE
Represents the schema type xs:date

XQBASETYPE_DATETIME

public static final int XQBASETYPE_DATETIME
Represents the schema type xs:dateTime

XQBASETYPE_DAYTIMEDURATION

public static final int XQBASETYPE_DAYTIMEDURATION
Represents the schema type xs:dayTimeDuration

XQBASETYPE_DECIMAL

public static final int XQBASETYPE_DECIMAL
Represents the schema type xs:decimal

XQBASETYPE_DOUBLE

public static final int XQBASETYPE_DOUBLE
Represents the schema type xs:double

XQBASETYPE_DURATION

public static final int XQBASETYPE_DURATION
Represents the schema type xs:duration

XQBASETYPE_ENTITIES

public static final int XQBASETYPE_ENTITIES
Represents the schema type xs:ENTITIES

XQBASETYPE_ENTITY

public static final int XQBASETYPE_ENTITY
Represents the schema type xs:ENTITY

XQBASETYPE_FLOAT

public static final int XQBASETYPE_FLOAT
Represents the schema type xs:float

XQBASETYPE_GDAY

public static final int XQBASETYPE_GDAY
Represents the schema type xs:gDay

XQBASETYPE_GMONTH

public static final int XQBASETYPE_GMONTH
Represents the schema type xs:gMonth

XQBASETYPE_GMONTHDAY

public static final int XQBASETYPE_GMONTHDAY
Represents the schema type xs:gMonthDay

XQBASETYPE_GYEAR

public static final int XQBASETYPE_GYEAR
Represents the schema type xs:gYear

XQBASETYPE_GYEARMONTH

public static final int XQBASETYPE_GYEARMONTH
Represents the schema type xs:gYearMonth

XQBASETYPE_HEXBINARY

public static final int XQBASETYPE_HEXBINARY
Represents the schema type xs:hexBinary

XQBASETYPE_ID

public static final int XQBASETYPE_ID
Represents the schema type xs:ID

XQBASETYPE_IDREF

public static final int XQBASETYPE_IDREF
Represents the schema type xs:IDREF

XQBASETYPE_IDREFS

public static final int XQBASETYPE_IDREFS
Represents the schema type xs:IDREFS. Valid only if the item kind is XQITEMKIND_ELEMENT, XQITEMKIND_DOCUMENT_ELEMENT, or XQITEMKIND_ATTRIBUTE

XQBASETYPE_INT

public static final int XQBASETYPE_INT
Represents the schema type xs:int

XQBASETYPE_INTEGER

public static final int XQBASETYPE_INTEGER
Represents the schema type xs:integer

XQBASETYPE_LANGUAGE

public static final int XQBASETYPE_LANGUAGE
Represents the schema type xs:language

XQBASETYPE_LONG

public static final int XQBASETYPE_LONG
Represents the schema type xs:long

XQBASETYPE_NAME

public static final int XQBASETYPE_NAME
Represents the schema type xs:Name

XQBASETYPE_NCNAME

public static final int XQBASETYPE_NCNAME
Represents the schema type xs:NCName

XQBASETYPE_NEGATIVE_INTEGER

public static final int XQBASETYPE_NEGATIVE_INTEGER
Represents the schema type xs:negativeInteger

XQBASETYPE_NMTOKEN

public static final int XQBASETYPE_NMTOKEN
Represents the schema type xs:NMToken

XQBASETYPE_NMTOKENS

public static final int XQBASETYPE_NMTOKENS
Represents the schema type xs:NMTOKENS

XQBASETYPE_NONNEGATIVE_INTEGER

public static final int XQBASETYPE_NONNEGATIVE_INTEGER
Represents the schema type xs:nonNegativeInteger

XQBASETYPE_NONPOSITIVE_INTEGER

public static final int XQBASETYPE_NONPOSITIVE_INTEGER
Represents the schema type xs:nonPositiveInteger

XQBASETYPE_NORMALIZED_STRING

public static final int XQBASETYPE_NORMALIZED_STRING
Represents the schema type xs:normalizedString

XQBASETYPE_NOTATION

public static final int XQBASETYPE_NOTATION
Represents the schema type xs:NOTATION

XQBASETYPE_POSITIVE_INTEGER

public static final int XQBASETYPE_POSITIVE_INTEGER
Represents the schema type xs:positiveInteger

XQBASETYPE_QNAME

public static final int XQBASETYPE_QNAME
Represents the schema type xs:QName

XQBASETYPE_SHORT

public static final int XQBASETYPE_SHORT
Represents the schema type xs:short

XQBASETYPE_STRING

public static final int XQBASETYPE_STRING
Represents the schema type xs:string

XQBASETYPE_TIME

public static final int XQBASETYPE_TIME
Represents the schema type xs:time

XQBASETYPE_TOKEN

public static final int XQBASETYPE_TOKEN
Represents the schema type xs:token

XQBASETYPE_UNSIGNED_BYTE

public static final int XQBASETYPE_UNSIGNED_BYTE
Represents the schema type xs:unsignedByte

XQBASETYPE_UNSIGNED_INT

public static final int XQBASETYPE_UNSIGNED_INT
Represents the schema type xs:unsignedInt

XQBASETYPE_UNSIGNED_LONG

public static final int XQBASETYPE_UNSIGNED_LONG
Represents the schema type xs:unsignedLong

XQBASETYPE_UNSIGNED_SHORT

public static final int XQBASETYPE_UNSIGNED_SHORT
Represents the schema type xs:unsignedShort

XQBASETYPE_UNTYPED

public static final int XQBASETYPE_UNTYPED
Represents the schema type xs:untyped

XQBASETYPE_UNTYPEDATOMIC

public static final int XQBASETYPE_UNTYPEDATOMIC
Represents the schema type xs:untypedAtomic

XQBASETYPE_YEARMONTHDURATION

public static final int XQBASETYPE_YEARMONTHDURATION
Represents the schema type xs:yearMonthDuration

XQITEMKIND_ATOMIC

public static final int XQITEMKIND_ATOMIC
Some atomic type.

XQITEMKIND_ATTRIBUTE

public static final int XQITEMKIND_ATTRIBUTE
Attribute node

XQITEMKIND_COMMENT

public static final int XQITEMKIND_COMMENT
Comment node

XQITEMKIND_DOCUMENT

public static final int XQITEMKIND_DOCUMENT
Document type (the type information represents the type of the document element)

XQITEMKIND_DOCUMENT_ELEMENT

public static final int XQITEMKIND_DOCUMENT_ELEMENT
Document node containing a single element node as its child (type information represents type of the element child)

XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT

public static final int XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
Document node containing a single schema element node as its child (type information represents type of the schema element child)

XQITEMKIND_ELEMENT

public static final int XQITEMKIND_ELEMENT
Element node

XQITEMKIND_ITEM

public static final int XQITEMKIND_ITEM
Any kind of item

XQITEMKIND_NODE

public static final int XQITEMKIND_NODE
Some node type

XQITEMKIND_PI

public static final int XQITEMKIND_PI
Processing instruction node

XQITEMKIND_SCHEMA_ATTRIBUTE

public static final int XQITEMKIND_SCHEMA_ATTRIBUTE
Schema attribute node

XQITEMKIND_SCHEMA_ELEMENT

public static final int XQITEMKIND_SCHEMA_ELEMENT
Schema element node

XQITEMKIND_TEXT

public static final int XQITEMKIND_TEXT
Text node

Method Detail

equals

public boolean equals(Object o)
Compares the specified object with this item type for equality. The result is true 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 and hashCode across different implementations the following algorithm must be used. Return true if and only if both objects are XQItemType and:

Parameters: o an XQItemType object representing an XQuery item type

Returns: true if the input item type object represents the same XQuery item type, false otherwise

getBaseType

public int getBaseType()
Returns the base type of the item. One of the XQBASETYPE_* 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, or XQITEMKIND_ATOMIC

getItemKind

public int getItemKind()
Returns the kind of the item. One of the XQITEMKIND_* constants.

Returns: int one of the XQITEMKIND_* constants indicating the basic kind of the item

getItemOccurrence

public int getItemOccurrence()
Returns the occurrence indicator for the item type. This method will always return the value XQSequenceType.OCC_EXACTLY_ONE.

Returns: int indicating the occurrence indicator

getNodeName

public QName getNodeName()
Returns the name of the node in case the item kind is an XQITEMKIND_DOCUMENT_ELEMENT, XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT, XQITEMKIND_ELEMENT, XQITEMKIND_SCHEMA_ELEMENT, XQITEMKIND_ATTRIBUTE, or XQITEMKIND_SCHEMA_ATTRIBUTE. For example, in the case of a type for element "foo" this will return the QName foo. For wildcard entries a null 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, or XQITEMKIND_SCHEMA_ATTRIBUTE

getPIName

public String getPIName()
Returns the name of the processing instruction type. As such the item kind of this XQItemType must be XQITEMKIND_PI.

Returns: the name of the processing instruction type. null if it is a wildcard

Throws: XQException if the item kind is not XQITEMKIND_PI

getSchemaURI

public 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 a null 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

public QName 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 single QName. If the return type is an anonymous type, the actual QName 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 be null

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, or XQITEMKIND_SCHEMA_ATTRIBUTE

hashCode

public int hashCode()
Returns a hash code consistent with the definition of the equals method.

In order to comply with the general contract of equals and hashCode 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();
 

Returns: hash code for this item type

isAnonymousType

public 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

public boolean isElementNillable()
Returns whether the element type is nillable or not.

Returns: true if the element type is nillable, false otherwise

toString

public String toString()
Returns a human-readable implementation-defined string representation of the item type.

Returns: String a string representation of the item type