com.ibm.xml.xapi
Interface XItemView
- 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:
- If the item is atomic (see the
isAtomic
method). - The item type (see the
getValueType
andgetValueTypeName
methods). - The value of the item (see the
get*Value
methods).
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.
Nested Class Summary
Nested classes/interfaces inherited from interface com.ibm.xml.xapi.XNodeView |
---|
XNodeView.Kind |
Method Summary
Modifier and Type | Method and Description |
---|---|
|
exportItem(javax.xml.transform.Result result)
Export to a
Result using the default output parameter settings.
|
|
exportItem(javax.xml.transform.Result result,XOutputParameters parameters)
Export to a
Result according to the specified output parameters.
|
|
getAnyURIValue()
Get the value as a Java String.
|
|
getBase64BinaryValue()
Get the value as a Java byte array.
|
|
getBooleanValue()
Get the value as a Java boolean.
|
|
getByteValue()
Get the value as a Java byte.
|
|
getDateTimeValue()
Get the value as a Java XMLGregorianCalendar.
|
|
getDateValue()
Get the value as a Java XMLGregorianCalendar.
|
|
getDayTimeDurationValue()
Get the value as a Java Duration.
|
|
getDecimalValue()
Get the value as a Java BigDecimal.
|
|
getDoubleValue()
Get the value as a Java double.
|
|
getDurationValue()
Get the value as a Java Duration.
|
|
getFloatValue()
Get the value as a Java float.
|
|
getGDayValue()
Get the value as a Java XMLGregorianCalendar.
|
|
getGMonthDayValue()
Get the value as a Java XMLGregorianCalendar.
|
|
getGMonthValue()
Get the value as a Java XMLGregorianCalendar.
|
|
getGYearMonthValue()
Get the value as a Java XMLGregorianCalendar.
|
|
getGYearValue()
Get the value as a Java XMLGregorianCalendar.
|
|
getHexBinaryValue()
Get the value as a Java byte array.
|
|
getIntegerValue()
Get the value as a Java BigInteger.
|
|
getIntValue()
Get the value as a Java int.
|
getListValue()
Get the list of values as an XSequenceCursor.
|
|
|
getLongValue()
Get the value as a Java long.
|
|
getNotationValue()
Get the value as a Java QName.
|
|
getObjectValue(XTypeConstants.Type type)
Get the value as the specified type where the type is one of the
enumerated values of
XTypeConstants.Type .
|
|
getQNameValue()
Get the value as a Java QName.
|
|
getShortValue()
Get the value as a Java short.
|
|
getStringValue()
Can be used for any type to return a string representation
of that value.
|
|
getTimeValue()
Get the value as a Java XMLGregorianCalendar.
|
getUnionValue()
Get the value inside the union as an XItemView.
|
|
getValueType()
Get the enumerated type of the value.
|
|
|
getValueTypeName()
Get the qualified schema type name of the value.
|
|
getYearMonthDurationValue()
Get the value as a Java Duration.
|
|
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()
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.
getValueTypeName
- javax.xml.namespace.QName getValueTypeName( )
QName
. getByteValue
- byte getByteValue()
getValueType
method first and
use the correct get*Value
method based on the returned type.
getShortValue
- short getShortValue()
getValueType
method first and
use the correct get*Value
method based on the returned type.
getIntValue
- int getIntValue()
getValueType
method first and
use the correct get*Value
method based on the returned type.
getLongValue
- long getLongValue()
getValueType
method first and
use the correct get*Value
method based on the returned type.
getFloatValue
- float getFloatValue()
getValueType
method first and
use the correct get*Value
method based on the returned type.
getDoubleValue
- double getDoubleValue()
getValueType
method first and
use the correct get*Value
method based on the returned type.
getBooleanValue
- boolean getBooleanValue()
getValueType
method first and
use the correct get*Value
method based on the returned type.
getDecimalValue
- java.math.BigDecimal getDecimalValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getIntegerValue
- java.math.BigInteger getIntegerValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getHexBinaryValue
- byte[] getHexBinaryValue()
getValueType
method first and
use the correct get*Value
method based on the returned type.
getBase64BinaryValue
- byte[] getBase64BinaryValue()
getValueType
method first and
use the correct get*Value
method based on the returned type.
getAnyURIValue
- java.lang.String getAnyURIValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getQNameValue
- javax.xml.namespace.QName getQNameValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getNotationValue
- javax.xml.namespace.QName getNotationValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getDateValue
- javax.xml.datatype.XMLGregorianCalendar getDateValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getDateTimeValue
- javax.xml.datatype.XMLGregorianCalendar getDateTimeValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getTimeValue
- javax.xml.datatype.XMLGregorianCalendar getTimeValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getGDayValue
- javax.xml.datatype.XMLGregorianCalendar getGDayValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getGMonthValue
- javax.xml.datatype.XMLGregorianCalendar getGMonthValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getGMonthDayValue
- javax.xml.datatype.XMLGregorianCalendar getGMonthDayValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getGYearValue
- javax.xml.datatype.XMLGregorianCalendar getGYearValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getGYearMonthValue
- javax.xml.datatype.XMLGregorianCalendar getGYearMonthValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getDurationValue
- javax.xml.datatype.Duration getDurationValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getDayTimeDurationValue
- javax.xml.datatype.Duration getDayTimeDurationValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getYearMonthDurationValue
- javax.xml.datatype.Duration getYearMonthDurationValue( )
getValueType
method first and
use the correct get*Value
method based on the returned type.
getUnionValue
- XItemView getUnionValue()
getValueType
method first and
use the correct get*Value
method based on the returned type.
getListValue
- XSequenceCursor getListValue()
getValueType
method first and
use the correct get*Value
method based on the returned type.
getObjectValue
- java.lang.Object getObjectValue( XTypeConstants.Type type)
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.
Object
. XViewException
- if the value cannot be converted. getStringValue
- java.lang.String getStringValue( )
exportItem
- void exportItem(javax.xml.transform.Result result,
- 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.
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
. exportItem
- 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.
result
- The Result
to export to.