com.ibm.xml.xapi

Interface XSequenceCursor

  • All Superinterfaces:
    XItemView, XNodeView


    public interface XSequenceCursor
    extends XItemView

    Represents a sequence of items providing cursor access to the items. Cursor traversal can be achieved through the toNext and toPrevious methods. When either of these methods is used the cursor will change state as it will now be pointing to a different item in the sequence. This means that other references to the same XSequenceCursor object will also now be pointing to the next or previous item.

    XSequenceCursor implements XItemView so that each item can be examined as the cursor is traversed. XItemView in turn implements XNodeView so that items of complex type can be examined as well.

    Note that null is used to represent an empty sequence so an XSequenceCursor will always contain at least one item.

    See Also:
    XItemView, XNodeView
    • Method Detail

      • toNext

        boolean toNext()
        Moves the cursor to the next item in the sequence.
        Returns:
        Returns true if the move was successful, false otherwise (if the cursor was already at the end of the sequence).
      • toPrevious

        boolean toPrevious()
        Moves the cursor to the previous item in the sequence.
        Returns:
        Returns true if the move was successful, false otherwise (if the cursor was already at the beginning of the sequence).
      • getSingletonItem

        XItemView getSingletonItem()
        Get the current item as a singleton. This method does not need to be called in order to examine the current item since XSequenceCursor implements XItemView. It is intended to be called only when a standalone item is needed that will not be affected by calls to toNext and toPrevious on the original sequence.
        Returns:
        A singleton XItemView object for the current item.
      • exportAsList

        java.util.List<XItemView> exportAsList()
        Exports the sequence as a List. The full sequence will be exported regardless of the current position of the cursor in the sequence. The resulting list will not be affected by any calls to toNext and toPrevious on the original sequence.
        Returns:
        The entire sequence as a List of XItemView.
      • exportSequence

        void exportSequence(javax.xml.transform.Result result,
                          XOutputParameters parameters)
        Export the sequence to a Result according to the specified output parameters. The full sequence will be exported regardless of the current position of the cursor in the sequence.

        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.
        • Items in the sequence that are attributes or namespaces will be ignored.
        • If the first item in the sequence is a document node, its children will be added to the document node that was created or events will be generated for the children. All other items in the sequence will be ignored.
        • All document node items that are not the first item in the sequence will be ignored.
        • An individual text node or characters event will be created for each atomic item.
        • All other items 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
      • exportSequence

        void exportSequence(javax.xml.transform.Result result)
        Export the sequence to a Result using the default output parameter settings. The full sequence will be exported regardless of the current position of the cursor in the sequence.

        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.
        • Items in the sequence that are attributes or namespaces will be ignored.
        • If the first item in the sequence is a document node, its children will be added to the document node that was created or events will be generated for the children. All other items in the sequence will be ignored.
        • All document node items that are not the first item in the sequence will be ignored.
        • An individual text node or characters event will be created for each atomic item.
        • All other items will be added to the document node or appropriate events generated.

        Parameters:
        result - The Result to export to.
      • append

        XSequenceCursor append(XItemView item)
        Create a new sequence cursor by appending the specified item to this sequence. The full sequence will be used regardless of the current position in the sequence. The resulting sequence will be positioned at the first item.
        Parameters:
        item - The item to append.
        Returns:
        A new sequence cursor containing all the items in this sequence with the given item appended at the end.
      • append

        XSequenceCursor append(XSequenceCursor sequence)
        Create a new sequence cursor by appending the items in the specified sequence to this sequence. The full set of items will be used regardless of the current position in either sequence. The resulting sequence will be positioned at the first item.
        Parameters:
        sequence - The sequence of items to append.
        Returns:
        A new sequence cursor containing all the items in this sequence with the items in the given sequence appended at the end.
IBM WebSphere Application Server XML API JavadocTM
Release 9.0