API

com.ibm.xml.xapi
Interface XItemView

All Superinterfaces:
XNodeView
All Known Subinterfaces:
XSequenceCursor, XTreeCursor

public interface XItemView
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
 void exportItem(Result result)
          Export to a Result using the default output parameter settings.
 void exportItem(Result result, XOutputParameters parameters)
          Export to a Result according to the specified output parameters.
 String getAnyURIValue()
          Get the value as a Java String.
 byte[] getBase64BinaryValue()
          Get the value as a Java byte array.
 boolean getBooleanValue()
          Get the value as a Java boolean.
 byte getByteValue()
          Get the value as a Java byte.
 XMLGregorianCalendar getDateTimeValue()
          Get the value as a Java XMLGregorianCalendar.
 XMLGregorianCalendar getDateValue()
          Get the value as a Java XMLGregorianCalendar.
 Duration getDayTimeDurationValue()
          Get the value as a Java Duration.
 BigDecimal getDecimalValue()
          Get the value as a Java BigDecimal.
 double getDoubleValue()
          Get the value as a Java double.
 Duration getDurationValue()
          Get the value as a Java Duration.
 float getFloatValue()
          Get the value as a Java float.
 XMLGregorianCalendar getGDayValue()
          Get the value as a Java XMLGregorianCalendar.
 XMLGregorianCalendar getGMonthDayValue()
          Get the value as a Java XMLGregorianCalendar.
 XMLGregorianCalendar getGMonthValue()
          Get the value as a Java XMLGregorianCalendar.
 XMLGregorianCalendar getGYearMonthValue()
          Get the value as a Java XMLGregorianCalendar.
 XMLGregorianCalendar getGYearValue()
          Get the value as a Java XMLGregorianCalendar.
 byte[] getHexBinaryValue()
          Get the value as a Java byte array.
 BigInteger getIntegerValue()
          Get the value as a Java BigInteger.
 int getIntValue()
          Get the value as a Java int.
 XSequenceCursor getListValue()
          Get the list of values as an XSequenceCursor.
 long getLongValue()
          Get the value as a Java long.
 QName getNotationValue()
          Get the value as a Java QName.
 Object getObjectValue(XTypeConstants.Type type)
          Get the value as the specified type where the type is one of the enumerated values of XTypeConstants.Type.
 QName getQNameValue()
          Get the value as a Java QName.
 short getShortValue()
          Get the value as a Java short.
 String getStringValue()
          Can be used for any type to return a string representation of that value.
 XMLGregorianCalendar getTimeValue()
          Get the value as a Java XMLGregorianCalendar.
 XItemView getUnionValue()
          Get the value inside the union as an XItemView.
 XTypeConstants.Type getValueType()
          Get the enumerated type of the value.
 QName getValueTypeName()
          Get the qualified schema type name of the value.
 Duration getYearMonthDurationValue()
          Get the value as a Java Duration.
 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

boolean isAtomic()
Returns whether the item is atomic or not.

Returns:
True if the item is atomic, false otherwise.

getValueType

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:
XTypeConstants.Type, getValueTypeName()

getValueTypeName

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

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:
getValueType()

getShortValue

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:
getValueType()

getIntValue

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:
getValueType()

getLongValue

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:
getValueType()

getFloatValue

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:
getValueType()

getDoubleValue

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:
getValueType()

getBooleanValue

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:
getValueType()

getDecimalValue

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:
getValueType()

getIntegerValue

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:
getValueType()

getHexBinaryValue

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:
getValueType()

getBase64BinaryValue

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:
getValueType()

getAnyURIValue

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:
getValueType()

getQNameValue

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:
getValueType()

getNotationValue

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:
getValueType()

getDateValue

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:
getValueType()

getDateTimeValue

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:
getValueType()

getTimeValue

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:
getValueType()

getGDayValue

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:
getValueType()

getGMonthValue

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:
getValueType()

getGMonthDayValue

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:
getValueType()

getGYearValue

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:
getValueType()

getGYearMonthValue

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:
getValueType()

getDurationValue

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:
getValueType()

getDayTimeDurationValue

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:
getValueType()

getYearMonthDurationValue

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:
getValueType()

getUnionValue

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:
getValueType()

getListValue

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:
getValueType()

getObjectValue

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.
XViewException - if the value cannot be converted.
See Also:
XTypeConstants.Type, getValueType()

getStringValue

String getStringValue()
Can be used for any type to return a string representation of that value.

Returns:
The string representation of the value.

exportItem

void exportItem(Result result,
                XOutputParameters parameters)

Export to a Result according to the specified output parameters. Note that standalone attribute and namespace nodes cannot be serialized. See Sequence Normalization for more details.

Supported Result types are:

Parameters:
result - The Result to export to.
parameters - The output parameter settings. See XOutputParameters.
See Also:
XOutputParameters

exportItem

void exportItem(Result result)

Export to a Result using the default output parameter settings. Note that standalone attribute and namespace nodes cannot be serialized. See Sequence Normalization for more details.

Supported Result types are:

Parameters:
result - The Result to export to.

IBM Copyright 2004-2008