com.ibm.xml.xapi
Interface XTreeCursor
- 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 thetoNextAttribute
method to move the cursor to the following attributes, one at a time. Use thetoParent
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 thetoNextSibling
method to move the cursor to the following children, one at a time. Use thetoParent
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 thetoNextNamespace
method to move the cursor to the following namespaces, one at a time. Use thetoParent
method to go back to the element.
Nested Class Summary
Nested classes/interfaces inherited from interface com.ibm.xml.xapi.XNodeView |
---|
XNodeView.Kind |
Method Summary
Modifier and Type | Method and Description |
---|---|
getSingletonItem()
Get the current node as a singleton.
|
|
|
toFirstAttribute()
Moves the cursor to the first attribute.
|
|
toFirstChild()
Moves the cursor to the first child.
|
|
toFirstNamespace()
Moves the cursor to the first namespace.
|
|
toNextAttribute()
Moves the cursor to the next attribute.
|
|
toNextNamespace()
Moves the cursor to the next namespace.
|
|
toNextSibling()
Moves the cursor to the next sibling element.
|
|
toParent()
Moves the cursor to the parent node.
|
|
toRoot()
Moves the cursor to the root node.
|
Methods inherited from interface com.ibm.xml.xapi.XNodeView |
---|
getDOMNode, getKind, getNodeQName, getTreeCursor, isSameDocument, relativePosition |
Method Detail
toFirstChild
- boolean toFirstChild()
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()
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()
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()
true
if the move was successful false
otherwise.
The move may be unsuccessful if there are no more siblings. toNextAttribute
- boolean toNextAttribute()
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()
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()
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()
true
(this method will always return true). getSingletonItem
- XItemView getSingletonItem()
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.
XItemView
object.