com.ibm.xml.xapi

Interface XSequenceCursor

All Superinterfaces:
XItemView, XNodeView

  1. public interface XSequenceCursor
  2. 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

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. XSequenceCursor
append(XItemView item)
Create a new sequence cursor by appending the specified item to this sequence.
  1. XSequenceCursor
append(XSequenceCursor sequence)
Create a new sequence cursor by appending the items in the specified sequence to this sequence.
  1. java.util.List<XItemView>
exportAsList()
Exports the sequence as a List.
  1. void
exportSequence(javax.xml.transform.Result result)
Export the sequence to a Result using the default output parameter settings.
  1. void
exportSequence(javax.xml.transform.Result result,XOutputParameters parameters)
Export the sequence to a Result according to the specified output parameters.
  1. XItemView
getSingletonItem()
Get the current item as a singleton.
  1. boolean
toNext()
Moves the cursor to the next item in the sequence.
  1. boolean
toPrevious()
Moves the cursor to the previous item in the sequence.
Methods inherited from interface com.ibm.xml.xapi.XItemView
exportItem, exportItem, getAnyURIValue, getBase64BinaryValue, getBooleanValue, getByteValue, getDateTimeValue, getDateValue, getDayTimeDurationValue, getDecimalValue, getDoubleValue, getDurationValue, getFloatValue, getGDayValue, getGMonthDayValue, getGMonthValue, getGYearMonthValue, getGYearValue, getHexBinaryValue, getIntegerValue, getIntValue, getListValue, getLongValue, getNotationValue, getObjectValue, getQNameValue, getShortValue, getStringValue, getTimeValue, getUnionValue, getValueType, getValueTypeName, getYearMonthDurationValue, isAtomic
Methods inherited from interface com.ibm.xml.xapi.XNodeView
getDOMNode, getKind, getNodeQName, getTreeCursor, isSameDocument, relativePosition

Method Detail

toNext

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

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

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

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

  1. void exportSequence(javax.xml.transform.Result result,
  2. 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:

exportSequence

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

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

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