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:

    • If the item is atomic (see the isAtomic method).
    • The item type (see the getValueType and getValueTypeName methods).
    • The value of the item (see the get*Value methods).
    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
    • 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

        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

        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

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

        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:
        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

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

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

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

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

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

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

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

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

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

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

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

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

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

        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:
        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

        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:
        XTypeConstants.Type, getValueType()
      • getStringValue

        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

        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.

        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:
        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.

        Parameters:
        result - The Result to export to.
IBM WebSphere Application Server XML API JavadocTM
Release 9.0