com.ibm.xml.xapi

Interface XItemView

All Superinterfaces:
XNodeView
All known subinterfaces:
XSequenceCursor, XTreeCursor

  1. public interface XItemView
  2. extends XNodeView

Represents an item in the data model. Various properties of an item can be examined using this interface such as:

The getValueType method should be called to determine which of the get*Value methods can be called for this particular item, unless the type is already known.

XItemView extends XNodeView so that items that are nodes can also be examined as nodes. The isAtomic method should be called before using any of the XNodeView methods as they are not valid for atomic items, unless it is known that the item is not atomic. The XNodeView methods will throw an exception if they are invoked for an atomic item.

Items can also be serialized using one of the exportItem methods.

The XSequenceCursor interface represents a sequence of items. It implements XItemView so that as the sequence is traversed the individual items can be examined.

See Also:
XNodeView, XSequenceCursor

Nested Class Summary

Nested classes/interfaces inherited from interface com.ibm.xml.xapi.XNodeView
XNodeView.Kind

Method Summary

Modifier and Type Method and Description
  1. void
exportItem(javax.xml.transform.Result result)
Export to a Result using the default output parameter settings.
  1. void
exportItem(javax.xml.transform.Result result,XOutputParameters parameters)
Export to a Result according to the specified output parameters.
  1. java.lang.String
getAnyURIValue()
Get the value as a Java String.
  1. byte[]
getBase64BinaryValue()
Get the value as a Java byte array.
  1. boolean
getBooleanValue()
Get the value as a Java boolean.
  1. byte
getByteValue()
Get the value as a Java byte.
  1. javax.xml.datatype.XMLGregorianCalendar
getDateTimeValue()
Get the value as a Java XMLGregorianCalendar.
  1. javax.xml.datatype.XMLGregorianCalendar
getDateValue()
Get the value as a Java XMLGregorianCalendar.
  1. javax.xml.datatype.Duration
getDayTimeDurationValue()
Get the value as a Java Duration.
  1. java.math.BigDecimal
getDecimalValue()
Get the value as a Java BigDecimal.
  1. double
getDoubleValue()
Get the value as a Java double.
  1. javax.xml.datatype.Duration
getDurationValue()
Get the value as a Java Duration.
  1. float
getFloatValue()
Get the value as a Java float.
  1. javax.xml.datatype.XMLGregorianCalendar
getGDayValue()
Get the value as a Java XMLGregorianCalendar.
  1. javax.xml.datatype.XMLGregorianCalendar
getGMonthDayValue()
Get the value as a Java XMLGregorianCalendar.
  1. javax.xml.datatype.XMLGregorianCalendar
getGMonthValue()
Get the value as a Java XMLGregorianCalendar.
  1. javax.xml.datatype.XMLGregorianCalendar
getGYearMonthValue()
Get the value as a Java XMLGregorianCalendar.
  1. javax.xml.datatype.XMLGregorianCalendar
getGYearValue()
Get the value as a Java XMLGregorianCalendar.
  1. byte[]
getHexBinaryValue()
Get the value as a Java byte array.
  1. java.math.BigInteger
getIntegerValue()
Get the value as a Java BigInteger.
  1. int
getIntValue()
Get the value as a Java int.
  1. XSequenceCursor
getListValue()
Get the list of values as an XSequenceCursor.
  1. long
getLongValue()
Get the value as a Java long.
  1. javax.xml.namespace.QName
getNotationValue()
Get the value as a Java QName.
  1. java.lang.Object
getObjectValue(XTypeConstants.Type type)
Get the value as the specified type where the type is one of the enumerated values of XTypeConstants.Type.
  1. javax.xml.namespace.QName
getQNameValue()
Get the value as a Java QName.
  1. short
getShortValue()
Get the value as a Java short.
  1. java.lang.String
getStringValue()
Can be used for any type to return a string representation of that value.
  1. javax.xml.datatype.XMLGregorianCalendar
getTimeValue()
Get the value as a Java XMLGregorianCalendar.
  1. XItemView
getUnionValue()
Get the value inside the union as an XItemView.
  1. XTypeConstants.Type
getValueType()
Get the enumerated type of the value.
  1. javax.xml.namespace.QName
getValueTypeName()
Get the qualified schema type name of the value.
  1. javax.xml.datatype.Duration
getYearMonthDurationValue()
Get the value as a Java Duration.
  1. boolean
isAtomic()
Returns whether the item is atomic or not.
Methods inherited from interface com.ibm.xml.xapi.XNodeView
getDOMNode, getKind, getNodeQName, getTreeCursor, isSameDocument, relativePosition

Method Detail

isAtomic

  1. boolean isAtomic()
Returns whether the item is atomic or not.
Returns:
True if the item is atomic, false otherwise.

getValueType

  1. XTypeConstants.Type getValueType( )

Get the enumerated type of the value. If the value is not atomic then XTypeConstants.Type.COMPLEX is returned. For a union type, XTypeConstants.Type.UNION will be returned. The getUnionValue method can then be called to get an XItemView for the value inside the union. For a list type, XTypeConstants.Type.LIST will be returned. The getListValue method can then be called to get the actual list of values as an XSequenceCursor.

The getValueTypeName method can be used to get the qualified schema type name.

Returns:
The type of the value.
See Also:

getValueTypeName

  1. javax.xml.namespace.QName getValueTypeName( )
Get the qualified schema type name of the value. Works for all types (atomic and complex).
Returns:
The schema type name as a QName.

getByteValue

  1. byte getByteValue()
Get the value as a Java byte. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getShortValue

  1. short getShortValue()
Get the value as a Java short. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getIntValue

  1. int getIntValue()
Get the value as a Java int. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getLongValue

  1. long getLongValue()
Get the value as a Java long. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getFloatValue

  1. float getFloatValue()
Get the value as a Java float. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getDoubleValue

  1. double getDoubleValue()
Get the value as a Java double. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getBooleanValue

  1. boolean getBooleanValue()
Get the value as a Java boolean. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getDecimalValue

  1. java.math.BigDecimal getDecimalValue( )
Get the value as a Java BigDecimal. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getIntegerValue

  1. java.math.BigInteger getIntegerValue( )
Get the value as a Java BigInteger. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getHexBinaryValue

  1. byte[] getHexBinaryValue()
Get the value as a Java byte array. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getBase64BinaryValue

  1. byte[] getBase64BinaryValue()
Get the value as a Java byte array. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getAnyURIValue

  1. java.lang.String getAnyURIValue( )
Get the value as a Java String. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getQNameValue

  1. javax.xml.namespace.QName getQNameValue( )
Get the value as a Java QName. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getNotationValue

  1. javax.xml.namespace.QName getNotationValue( )
Get the value as a Java QName. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getDateValue

  1. javax.xml.datatype.XMLGregorianCalendar getDateValue( )
Get the value as a Java XMLGregorianCalendar. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getDateTimeValue

  1. javax.xml.datatype.XMLGregorianCalendar getDateTimeValue( )
Get the value as a Java XMLGregorianCalendar. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getTimeValue

  1. javax.xml.datatype.XMLGregorianCalendar getTimeValue( )
Get the value as a Java XMLGregorianCalendar. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getGDayValue

  1. javax.xml.datatype.XMLGregorianCalendar getGDayValue( )
Get the value as a Java XMLGregorianCalendar. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getGMonthValue

  1. javax.xml.datatype.XMLGregorianCalendar getGMonthValue( )
Get the value as a Java XMLGregorianCalendar. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getGMonthDayValue

  1. javax.xml.datatype.XMLGregorianCalendar getGMonthDayValue( )
Get the value as a Java XMLGregorianCalendar. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getGYearValue

  1. javax.xml.datatype.XMLGregorianCalendar getGYearValue( )
Get the value as a Java XMLGregorianCalendar. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getGYearMonthValue

  1. javax.xml.datatype.XMLGregorianCalendar getGYearMonthValue( )
Get the value as a Java XMLGregorianCalendar. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getDurationValue

  1. javax.xml.datatype.Duration getDurationValue( )
Get the value as a Java Duration. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getDayTimeDurationValue

  1. javax.xml.datatype.Duration getDayTimeDurationValue( )
Get the value as a Java Duration. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getYearMonthDurationValue

  1. javax.xml.datatype.Duration getYearMonthDurationValue( )
Get the value as a Java Duration. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getUnionValue

  1. XItemView getUnionValue()
Get the value inside the union as an XItemView. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getListValue

  1. XSequenceCursor getListValue()
Get the list of values as an XSequenceCursor. Throws an exception if the item cannot be converted to that type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Throws:
XViewException - if the value cannot be converted.
See Also:

getObjectValue

  1. java.lang.Object getObjectValue( XTypeConstants.Type type)
Get the value as the specified type where the type is one of the enumerated values of XTypeConstants.Type. If the type is UNTYPEDATOMIC a String object will be returned. If the type is COMPLEX a DOM Node will be returned. For other types the closest Java object will be returned (Float for FLOAT, XMLGregorianCalendar for DATE, etc.). Throws an exception if the item cannot be converted to the given type. To avoid exceptions call the getValueType method first and use the correct get*Value method based on the returned type.
Returns:
The value as a Java Object.
Throws:
XViewException - if the value cannot be converted.
See Also:

getStringValue

  1. java.lang.String getStringValue( )
Can be used for any type to return a string representation of that value.
Returns:
The string representation of the value.

exportItem

  1. void exportItem(javax.xml.transform.Result result,
  2. XOutputParameters parameters)

Export to a Result according to the specified output parameters.

Supported Result types are:

  • StreamResult
  • SAXResult
  • DOMResult
  • StAXResult

For StreamResult the behavior is defined by the XSLT 2.0 and XQuery 1.0 Serialization specification. Note that standalone attribute and namespace nodes cannot be serialized and will result in an error. See Sequence Normalization for more details.

For the other result types:

  • A document node or document event will be created.
  • If the item is an attribute or a namespace node it will be ignored.
  • If the item is a document node, its children will be added to the document node that was created or events will be generated for the children.
  • If the item is atomic, a text node or characters event will be created.
  • Otherwise the item will be added to the document node or appropriate events generated.

Note that the output parameters only apply to StreamResult and have no effect on the other result types.

Parameters:
result - The Result to export to.
parameters - The output parameter settings. Output parameters apply to StreamResult only and have no effect on the other result types. See XOutputParameters.
See Also:

exportItem

  1. void exportItem(javax.xml.transform.Result result)

Export to a Result using the default output parameter settings.

Supported Result types are:

  • StreamResult
  • SAXResult
  • DOMResult
  • StAXResult

For StreamResult the behavior is defined by the XSLT 2.0 and XQuery 1.0 Serialization specification. Note that standalone attribute and namespace nodes cannot be serialized and will result in an error. See Sequence Normalization for more details.

For the other result types:

  • A document node or document event will be created.
  • If the item is an attribute or a namespace node it will be ignored.
  • If the item is a document node, its children will be added to the document node that was created or events will be generated for the children.
  • If the item is atomic, a text node or characters event will be created.
  • Otherwise the item will be added to the document node or appropriate events generated.

Parameters:
result - The Result to export to.