org.gxml.u
Interface GuCursor<N>

All Superinterfaces:
java.lang.Comparable<GuCursor<N>>, Cursor<N,java.lang.String,javax.xml.namespace.QName>, GuWritable<N>

public interface GuCursor<N>
extends java.lang.Comparable<GuCursor<N>>, GuWritable<N>, Cursor<N,java.lang.String,javax.xml.namespace.QName>

A cursor is a random-access representation of an XML tree with the unique property that it moves over the underlying data model without forcing the implementation to provide object handles for each node visited.

A cursor may be moved over the underlying data model and provides access to the properties of its underlying node.


Method Summary
 N bookmark()
           
 java.lang.Iterable<javax.xml.namespace.QName> getAttributeNames(boolean orderCanonical)
          Returns the set of attribute names for the current node.
 int getLineNumber()
          Returns the line number, or -1 if none is available.
 java.lang.String getLocalName()
          Returns the local-name property of the dm:node-name.
 java.lang.Iterable<java.lang.String> getNamespaceNames(boolean orderCanonical)
          Returns the set of namespace names (prefixes) for the current node.
 java.lang.String getNamespaceURI()
          Returns the namespace-uri part of the dm:node-name.
 NodeKind getNodeKind()
          Returns the dm:node-kind property of the XDM as an enumeration in NodeKind.
 java.lang.String getPrefix()
          Returns the prefix part of the dm:node-name.
 GuProcessingContext<N> getProcessingContext()
          Returns the processing context that is effective for this cursor.
 java.lang.String getStringValue()
           
 boolean hasAttributes()
           
 boolean hasChildren()
           
 boolean hasNamespaces()
           
 boolean hasNextSibling()
           
 boolean hasParent()
           
 boolean hasPreviousSibling()
           
 boolean isSameNode(GuCursor<N> other)
          Determines whether the current node is identically equal to the node specified by the argument.
 boolean matches(NodeKind nodeKind, java.lang.String namespaceURI, java.lang.String localName)
          Deterimines whether the cursor matches the arguments.
 void moveTo(N bookmark)
          Positions the cursor at the specified bookmark.
 boolean moveToAttribute(java.lang.String namespaceURI, java.lang.String localName)
          Moves to the attribute node with the specified expanded-QName.
 boolean moveToFirstChild()
          Moves the cursor to the first node along the child axis.
 boolean moveToFirstChildElement()
          Moves the cursor to the first element along the child axis.
 boolean moveToFirstChildElementByName(java.lang.String namespaceURI, java.lang.String localName)
          Moves the cursor to the first element with the specified name along the child axis.
 boolean moveToLastChild()
          Moves the cursor to the last node along the child axis.
 boolean moveToNextSibling()
          Moves the cursor to the next node along the following-sibling axis.
 boolean moveToNextSiblingElement()
          Moves the cursor to the next element along the following-sibling axis.
 boolean moveToNextSiblingElementByName(java.lang.String namespaceURI, java.lang.String localName)
          Moves the cursor to the next element along the following-sibling axis.
 boolean moveToParent()
          Moves the cursor to the node along the parent axis.
 boolean moveToPreviousSibling()
          Moves the cursor to the next node along the preceding-sibling axis.
 void moveToRoot()
          Moves the cursor to the farthest node along the ancestor axis.
 void write(GuContentHandler writer)
          Support for streaming the current node to a GuContentHandler.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

bookmark

N bookmark()
Specified by:
bookmark in interface Cursor<N,java.lang.String,javax.xml.namespace.QName>
Returns:
an immovable bookmark for the current cursor position.

getAttributeNames

java.lang.Iterable<javax.xml.namespace.QName> getAttributeNames(boolean orderCanonical)
Returns the set of attribute names for the current node.

Parameters:
orderCanonical - Determines whether the names will be returned in canonical order (lexicographically by namespace URI, local name).

getLineNumber

int getLineNumber()
Returns the line number, or -1 if none is available.


getLocalName

java.lang.String getLocalName()
Returns the local-name property of the dm:node-name.
An empty local-name is returned as the zero-length string.
This method never returns null.

Specified by:
getLocalName in interface Cursor<N,java.lang.String,javax.xml.namespace.QName>

getNamespaceNames

java.lang.Iterable<java.lang.String> getNamespaceNames(boolean orderCanonical)
Returns the set of namespace names (prefixes) for the current node.

Parameters:
orderCanonical - Determines whether the names will be returned in canonical order (lexicographically by local name).

getNamespaceURI

java.lang.String getNamespaceURI()
Returns the namespace-uri part of the dm:node-name.
An empty namespace-uri is returned as the zero-length string.
This method never returns null.


getNodeKind

NodeKind getNodeKind()
Returns the dm:node-kind property of the XDM as an enumeration in NodeKind.


getPrefix

java.lang.String getPrefix()
Returns the prefix part of the dm:node-name.
This is just a hint because it usually contains the prefix of the original document. The prefix will not be updated to reflect in scope namespaces.


getProcessingContext

GuProcessingContext<N> getProcessingContext()
Returns the processing context that is effective for this cursor. For implementers, it is important that this method returns the outermost processing context.

Specified by:
getProcessingContext in interface GuWritable<N>

getStringValue

java.lang.String getStringValue()
Returns:
the dm:string-value property of the XDM.

hasAttributes

boolean hasAttributes()
Returns:
true if the node has attributes, otherwise false.

hasChildren

boolean hasChildren()
Returns:
true if the node has children, otherwise false.

hasNamespaces

boolean hasNamespaces()
Returns:
true if the node has prefix-to-namespace mappings, otherwise false.

hasNextSibling

boolean hasNextSibling()
Returns:
true if the node has a following sibling, otherwise false.

hasParent

boolean hasParent()
Returns:
true if the node has a parent, otherwise false.

hasPreviousSibling

boolean hasPreviousSibling()
Returns:
true if the node has a preceding sibling, otherwise false.

isSameNode

boolean isSameNode(GuCursor<N> other)
Determines whether the current node is identically equal to the node specified by the argument.


matches

boolean matches(NodeKind nodeKind,
                java.lang.String namespaceURI,
                java.lang.String localName)
Deterimines whether the cursor matches the arguments.

Parameters:
nodeKind - The node kind to match.
namespaceURI - The namespace-uri to match.
localName - The local-name to match.
Returns:
true if the cursor matches the specified arguments.

moveTo

void moveTo(N bookmark)
Positions the cursor at the specified bookmark.

Parameters:
bookmark - The bookmark to which the cursor should be positioned.

moveToAttribute

boolean moveToAttribute(java.lang.String namespaceURI,
                        java.lang.String localName)
Moves to the attribute node with the specified expanded-QName. Assumes that the cursor is initially positioned on an element with the required attribute.

Parameters:
namespaceURI - The namespace-uri part of the attribute name.
localName - The local-name part of the attribute name.

moveToFirstChild

boolean moveToFirstChild()
Moves the cursor to the first node along the child axis.

Returns:
true if the cursor moved, otherwise false.

moveToFirstChildElement

boolean moveToFirstChildElement()
Moves the cursor to the first element along the child axis.

Returns:
true if the cursor moved, otherwise false.

moveToFirstChildElementByName

boolean moveToFirstChildElementByName(java.lang.String namespaceURI,
                                      java.lang.String localName)
Moves the cursor to the first element with the specified name along the child axis.

Returns:
true if the cursor moved, otherwise false.

moveToLastChild

boolean moveToLastChild()
Moves the cursor to the last node along the child axis.

Returns:
true if the cursor moved, otherwise false.

moveToNextSibling

boolean moveToNextSibling()
Moves the cursor to the next node along the following-sibling axis.

Returns:
true if the cursor moved, otherwise false.

moveToNextSiblingElement

boolean moveToNextSiblingElement()
Moves the cursor to the next element along the following-sibling axis.

Returns:
true if the cursor moved, otherwise false.

moveToNextSiblingElementByName

boolean moveToNextSiblingElementByName(java.lang.String namespaceURI,
                                       java.lang.String localName)
Moves the cursor to the next element along the following-sibling axis.

Returns:
true if the cursor moved, otherwise false.

moveToParent

boolean moveToParent()
Moves the cursor to the node along the parent axis.

Returns:
true if the cursor moved, otherwise false.

moveToPreviousSibling

boolean moveToPreviousSibling()
Moves the cursor to the next node along the preceding-sibling axis.

Returns:
true if the cursor moved, otherwise false.

moveToRoot

void moveToRoot()
Moves the cursor to the farthest node along the ancestor axis.


write

void write(GuContentHandler writer)
           throws java.io.IOException
Support for streaming the current node to a GuContentHandler.

Specified by:
write in interface GuWritable<N>
Parameters:
writer - The handler for events generated.
Throws:
java.io.IOException


Copyright © 2009 TIBCO Software Inc. All Rights Reserved.