com.ibm.xml.xapi

Interface XTreeCursor

  • All Superinterfaces:
    XItemView, XNodeView


    public interface XTreeCursor
    extends XItemView

    Represents a node providing cursor access to the attributes and children of the node. Traversal of the tree is achieved through the various "to" methods. When any of these methods is used the cursor will change state as it will now be pointing to a different node in the tree. This means that other references to the same XTreeCursor object will also now be pointing to the new node.

    An XTreeCursor can be obtained by using the XNodeView getTreeCursor interface.

    XtreeCursor implements XItemView which in turn implements XNodeView allowing each to be examined as the cursor is traversed. The XItemView interface provides access to the schema type and typed value of a node. The XNodeView interface provides access to the node name, node kind, etc.

    Examples:

    • View Attributes of an Element - First use the toFirstAttribute method to move the cursor to the first attribute. Use the toNextAttribute method to move the cursor to the following attributes, one at a time. Use the toParent method to go back to the element.
    • View Children of an Element - First use the toFirstChild method to move the cursor to the first child. Use the toNextSibling method to move the cursor to the following children, one at a time. Use the toParent method to go back to the element.
    • View Namespaces of an Element - First use the toFirstNamespace method to move the cursor to the first namespace. Use the toNextNamespace method to move the cursor to the following namespaces, one at a time. Use the toParent method to go back to the element.

    See Also:
    XItemView, XNodeView
    • Method Detail

      • toFirstChild

        boolean toFirstChild()
        Moves the cursor to the first child.
        Returns:
        Returns true if the move was successful, false otherwise. The move may be unsuccessful if there are no children or if the cursor is not currently positioned on an element node or document node.
      • toFirstAttribute

        boolean toFirstAttribute()
        Moves the cursor to the first attribute.
        Returns:
        Returns true if the move was successful, false otherwise. The move may be unsuccessful if there are no attributes or if the cursor is not currently positioned on an element node.
      • toFirstNamespace

        boolean toFirstNamespace()
        Moves the cursor to the first namespace.
        Returns:
        Returns true if the move was successful, false otherwise. The move may be unsuccessful if there are no namespaces or if the cursor is not currently positioned on an element node.
      • toNextSibling

        boolean toNextSibling()
        Moves the cursor to the next sibling element.
        Returns:
        Returns true if the move was successful false otherwise. The move may be unsuccessful if there are no more siblings.
      • toNextAttribute

        boolean toNextAttribute()
        Moves the cursor to the next attribute.
        Returns:
        Returns true if the move was successful false otherwise. The move may be unsuccessful if there are no more attributes or if not at the attribute level (toFirstAttribute was not called).
      • toNextNamespace

        boolean toNextNamespace()
        Moves the cursor to the next namespace.
        Returns:
        Returns true if the move was successful false otherwise. The move may be unsuccessful if there are no more namespaces or if not at the namespace level (toFirstNamespace was not called).
      • toParent

        boolean toParent()
        Moves the cursor to the parent node.
        Returns:
        Returns true if the move was successful false otherwise. The move may be unsuccessful if the cursor is currently positioned at the root.
      • toRoot

        boolean toRoot()
        Moves the cursor to the root node.
        Returns:
        Returns true (this method will always return true).
      • getSingletonItem

        XItemView getSingletonItem()
        Get the current node as a singleton. This method does not need to be called in order to examine the current node since XTreeCursor implements XItemView which in turn implements XNodeView. It is intended to be called only when a standalone item is needed that will not be affected by calls to the "to" methods on the original tree cursor.
        Returns:
        A singleton XItemView object.
IBM WebSphere Application Server XML API JavadocTM
Release 9.0