te the ItemTypes for string and integer XQItemType strType = conn.createAtomicType(XQItemType.XQBASETYPE_STRING); XQItemType intType = conn.createAtomicType(XQItemType.XQBASETYPE_INT); // positioned before the first item while (result.next()) { XQItemType type = result.getItemType(); // If string, then get the string value out if (type.equals(strType)) String str = result.getAtomicValue(); else if (type.equals(intType)) // if it is an integer.. int intval = result.getInt(); ... } In a sequence, the cursor may be positioned on an item, after the last item or before the first item. The
getPosition
method returns the current position number. A value of 0 indicates that it is positioned before the first item, a value of
count() + 1
indicates that it is positioned after the last item, and any other value indicates that it is positioned on the item at that position.
For example, a position value of 1 indicates that it is positioned on the item at position 1.
The isOnItem
method may be used to find out if the cursor is positioned on the item. When the cursor is positioned on an item, the next
method call will move the cursor to be on the next item.
See also: Section 12 Serialization, XQuery API for Java (XQJ) 1.0, which describes some general information applicable to various XQJ serialization methods.