org.gxml.u
Interface GuModel<N>

All Superinterfaces:
java.util.Comparator<N>, Model<N,java.lang.String,javax.xml.namespace.QName>

public interface GuModel<N>
extends java.util.Comparator<N>, Model<N,java.lang.String,javax.xml.namespace.QName>

The model provides the tree API.

End users will normally consume, rather than implement, this interface.


Method Summary
 int compare(N one, N two)
          Determines the relative document order of two nodes.
 java.lang.Iterable<N> getAncestorAxis(N node)
          Returns the nodes along the ancestor axis using the specified node as the origin.
 java.lang.Iterable<N> getAncestorOrSelfAxis(N node)
          Returns the nodes along the ancestor-or-self axis using the specified node as the origin.
 N getAttribute(N node, java.lang.String namespaceURI, java.lang.String localName)
          Returns the attribute node with the specified expanded-QName.
 java.lang.Iterable<N> getAttributeAxis(N node, boolean inherit)
          Returns the nodes along the attribute axis using the specified node as the origin.
 java.lang.Iterable<javax.xml.namespace.QName> getAttributeNames(N node, boolean orderCanonical)
          Returns the set of attribute names for the node.
 java.lang.Iterable<N> getAttributes(N node)
          Returns the attribute nodes that are local to the specified element.
 java.lang.Iterable<N> getAttributesInScope(N node)
          Returns the attribute nodes that are local to the specified element as well as those in the reserved XML namespace that are inherited.
 java.lang.Iterable<N> getChildAxis(N node)
          Returns the nodes along the child axis using the specified node as the origin.
 java.lang.Iterable<N> getChildElements(N node)
          Returns all the child element along the child axis.
 java.lang.Iterable<N> getChildElementsByName(N node, java.lang.String namespaceURI, java.lang.String localName)
          Returns all the child element along the child axis whose names match the arguments supplied.
 java.lang.Iterable<N> getDescendantAxis(N node)
          Returns the nodes along the descendant axis using the specified node as the origin.
 java.lang.Iterable<N> getDescendantOrSelfAxis(N node)
          Returns the nodes along the descendant-or-self axis using the specified node as the origin.
 N getFirstChild(N node)
          Returns the first child node of the node provided.
 N getFirstChildElement(N node)
          Returns the first element along the child axis.
 N getFirstChildElementByName(N node, java.lang.String namespaceURI, java.lang.String localName)
          Returns the first child element along the child axis whose name matches the arguments supplied.
 java.lang.Iterable<N> getFollowingAxis(N node)
          Returns the nodes along the following axis using the specified node as the origin.
 java.lang.Iterable<N> getFollowingSiblingAxis(N node)
          Returns the nodes along the following-sibling axis using the specified node as the origin.
 N getLastChild(N node)
          Returns the last child node of the node provided.
 int getLineNumber(N node)
          Returns the line number, or -1 if none is available.
 java.lang.String getLocalName(N node)
          Returns the local-name part of the dm:node-name.
 java.lang.Iterable<N> getNamespaceAxis(N node, boolean inherit)
          Returns the nodes along the namespace axis using the specified node as the origin.
 java.lang.Iterable<java.lang.String> getNamespaceNames(N node, boolean orderCanonical)
          Returns the set of namespace names (prefixes) for a given node.
 java.lang.Iterable<N> getNamespaces(N node)
          Returns the namespace nodes that are local to the specified element.
 java.lang.Iterable<N> getNamespacesInScope(N node)
          Returns the namespace nodes that are local to the specified element as well as those that are inherited.
 java.lang.String getNamespaceURI(N node)
          Returns the namespace-uri part of the dm:node-name.
 java.lang.String getNamespaceURI(N node, java.lang.String prefix)
           
 java.lang.String getNamespaceURIInScope(N node, java.lang.String prefix)
          Returns the namespace-uri associated with the specified prefix using a node as a starting context.
 N getNextSibling(N node)
          Returns the next sibling node of the node provided.
 N getNextSiblingElement(N node)
          Returns the next element along the child axis.
 N getNextSiblingElementByName(N node, java.lang.String namespaceURI, java.lang.String localName)
          Returns the next element along the following-sibling axis whose name matches the arguments supplied.
 NodeKind getNodeKind(N node)
          Returns the node-kind of the node as an enumeration in NodeKind.
 N getParent(N node)
          Returns the parent node of the node provided.
 java.lang.Iterable<N> getPrecedingAxis(N node)
          Returns the nodes along the preceding axis using the specified node as the origin.
 java.lang.Iterable<N> getPrecedingSiblingAxis(N node)
          Returns the nodes along the preceding-sibling axis using the specified node as the origin.
 java.lang.String getPrefix(N node)
          Returns the prefix part of the node name.
 N getPreviousSibling(N node)
          Returns the previous sibling node of the node provided.
 N getRoot(N node)
          Returns the identity of the top-most node along the ancestor-or-self axis from this node.
 java.lang.String getStringValue(N node)
          Returns the dm:string-value property of the node.
 boolean hasAttributes(N node)
          Determines whether there are nodes on the attribute axis for this node.
 boolean hasChildren(N node)
          Determines whether there are nodes on the child axis for this node.
 boolean hasNamespaces(N node)
          Determines whether there are prefix-to-namespace mappings for this node.
 boolean hasNextSibling(N node)
          Determines whether the node has a following sibling.
 boolean hasParent(N node)
          Determines whether there are nodes on the parent axis for this node.
 boolean hasPreviousSibling(N node)
          Determines whether the node has a preceding sibling.
 boolean isSameNode(N one, N two)
          Determines whether the two nodes represent the same nodes based upon identity.
 boolean matches(N node, NodeKind nodeKind, java.lang.String namespaceURI, java.lang.String localName)
          Deterimines whether the specified node matches the arguments.
 N[] nodeArray(int size)
          Allocates an empty array of nodes.
 void write(N node, GuContentHandler writer)
          Support for streaming a node to a GuContentHandler.
 
Methods inherited from interface java.util.Comparator
equals
 

Method Detail

compare

int compare(N one,
            N two)
Determines the relative document order of two nodes.

Specified by:
compare in interface java.util.Comparator<N>
Parameters:
one - The first node used in the comparison.
two - The second node in the comparison.

getAttribute

N getAttribute(N node,
               java.lang.String namespaceURI,
               java.lang.String localName)
Returns the attribute node with the specified expanded-QName.

Specified by:
getAttribute in interface Model<N,java.lang.String,javax.xml.namespace.QName>
Parameters:
node - The node that is the parent of the attribute node.
namespaceURI - The namespace-uri part of the attribute name.
localName - The local-name part of the attribute name.

getAttributeNames

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

This method does not inherit attribute names in the reserved XML namespace.

Specified by:
getAttributeNames in interface Model<N,java.lang.String,javax.xml.namespace.QName>
Parameters:
node - The node for which the attribute names are required.
orderCanonical - Determines whether the names will be returned in canonical order (lexicographically by namespace URI,local name).

getAttributes

java.lang.Iterable<N> getAttributes(N node)
Returns the attribute nodes that are local to the specified element.

Parameters:
node - The origin node.

getAttributesInScope

java.lang.Iterable<N> getAttributesInScope(N node)
Returns the attribute nodes that are local to the specified element as well as those in the reserved XML namespace that are inherited. The inherited attributes must have the same parent as the node specified.

Parameters:
node - The origin node.

getFirstChild

N getFirstChild(N node)
Returns the first child node of the node provided.

Parameters:
node - The node for which the first child node is required.

getLastChild

N getLastChild(N node)
Returns the last child node of the node provided.

Parameters:
node - The node for which the last child node is required.

getLocalName

java.lang.String getLocalName(N node)
Returns the local-name part 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 Model<N,java.lang.String,javax.xml.namespace.QName>
Parameters:
node - The node for which the node local-name is required.

getNamespaceNames

java.lang.Iterable<java.lang.String> getNamespaceNames(N node,
                                                       boolean orderCanonical)
Returns the set of namespace names (prefixes) for a given node.
This refers to the prefix mappings which are explicit and local to the node.

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

getNamespaces

java.lang.Iterable<N> getNamespaces(N node)
Returns the namespace nodes that are local to the specified element.

Parameters:
node - The origin node.

getNamespacesInScope

java.lang.Iterable<N> getNamespacesInScope(N node)
Returns the namespace nodes that are local to the specified element as well as those that are inherited. The inherited namespaces must have the same parent as the node specified.

Parameters:
node - The origin node.

getNamespaceURI

java.lang.String getNamespaceURI(N node)
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.

Specified by:
getNamespaceURI in interface Model<N,java.lang.String,javax.xml.namespace.QName>
Parameters:
node - The node for which the node namespace-uri is required.

getNamespaceURI

java.lang.String getNamespaceURI(N node,
                                 java.lang.String prefix)

getNamespaceURIInScope

java.lang.String getNamespaceURIInScope(N node,
                                        java.lang.String prefix)
Returns the namespace-uri associated with the specified prefix using a node as a starting context.


getNextSibling

N getNextSibling(N node)
Returns the next sibling node of the node provided.

Parameters:
node - The node for which the next sibling node is required.

getNodeKind

NodeKind getNodeKind(N node)
Returns the node-kind of the node as an enumeration in NodeKind. Applies to all node kinds and never returns null.
Corresponds to the dm:node-kind accessor in the XDM.

Specified by:
getNodeKind in interface Model<N,java.lang.String,javax.xml.namespace.QName>
Parameters:
node - The node for which the node-kind is required.

getParent

N getParent(N node)
Returns the parent node of the node provided.
May return null for top-most or orphaned nodes.
Corresponds to the dm:parent accessor in the XDM.

Specified by:
getParent in interface Model<N,java.lang.String,javax.xml.namespace.QName>
Parameters:
node - The node for which the parent is required.

getPrefix

java.lang.String getPrefix(N node)
Returns the prefix part of the 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. The return value is never null. Even in cases where there is no prefix hint, the value is the zero-length string.

Parameters:
node - The node for which the prefix-hint is required.

getPreviousSibling

N getPreviousSibling(N node)
Returns the previous sibling node of the node provided.

Parameters:
node - The node for which the previous sibling node is required.

getStringValue

java.lang.String getStringValue(N node)
Returns the dm:string-value property of the node. Applies to all node kinds.

Specified by:
getStringValue in interface Model<N,java.lang.String,javax.xml.namespace.QName>
Parameters:
node - The node for which the dm:string-value is required.

hasAttributes

boolean hasAttributes(N node)
Determines whether there are nodes on the attribute axis for this node.

Parameters:
node - The node under consideration.

hasChildren

boolean hasChildren(N node)
Determines whether there are nodes on the child axis for this node.

Parameters:
node - The node under consideration.

hasNamespaces

boolean hasNamespaces(N node)
Determines whether there are prefix-to-namespace mappings for this node.

Parameters:
node - The node under consideration.

hasNextSibling

boolean hasNextSibling(N node)
Determines whether the node has a following sibling.

Parameters:
node - The node under consideration.

hasParent

boolean hasParent(N node)
Determines whether there are nodes on the parent axis for this node.

Parameters:
node - The node under consideration.

hasPreviousSibling

boolean hasPreviousSibling(N node)
Determines whether the node has a preceding sibling.

Parameters:
node - The node under consideration.

isSameNode

boolean isSameNode(N one,
                   N two)
Determines whether the two nodes represent the same nodes based upon identity.

Parameters:
one - The first node used in the comparison.
two - The second node used in the comparison.

matches

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

Parameters:
node - The XML node.
nodeKind - The node kind to match.
namespaceURI - The namespace-uri to match.
localName - The local-name to match.

nodeArray

N[] nodeArray(int size)
Allocates an empty array of nodes.

Parameters:
size - The size of the array of nodes.

getAncestorAxis

java.lang.Iterable<N> getAncestorAxis(N node)
Returns the nodes along the ancestor axis using the specified node as the origin.

Specified by:
getAncestorAxis in interface Model<N,java.lang.String,javax.xml.namespace.QName>
Parameters:
node - The origin node.

getAncestorOrSelfAxis

java.lang.Iterable<N> getAncestorOrSelfAxis(N node)
Returns the nodes along the ancestor-or-self axis using the specified node as the origin.

Specified by:
getAncestorOrSelfAxis in interface Model<N,java.lang.String,javax.xml.namespace.QName>
Parameters:
node - The origin node.

getAttributeAxis

java.lang.Iterable<N> getAttributeAxis(N node,
                                       boolean inherit)
Returns the nodes along the attribute axis using the specified node as the origin.
Corresponds to the dm:attributes accessor in the XDM.

Parameters:
node - The origin node.
inherit - Determines whether attribultes in the XML namespace will be inherited. The standard value for this parameter is false.

getChildAxis

java.lang.Iterable<N> getChildAxis(N node)
Returns the nodes along the child axis using the specified node as the origin.
Corresponds to the dm:children accessor in the XDM.

Specified by:
getChildAxis in interface Model<N,java.lang.String,javax.xml.namespace.QName>
Parameters:
node - The origin node.

getChildElements

java.lang.Iterable<N> getChildElements(N node)
Returns all the child element along the child axis.

Parameters:
node - The parent node that owns the child axis.

getChildElementsByName

java.lang.Iterable<N> getChildElementsByName(N node,
                                             java.lang.String namespaceURI,
                                             java.lang.String localName)
Returns all the child element along the child axis whose names match the arguments supplied.

Parameters:
node - The parent node that owns the child axis.
namespaceURI - The namespace-uri to be matched.
localName - The local-name to be matched.

getDescendantAxis

java.lang.Iterable<N> getDescendantAxis(N node)
Returns the nodes along the descendant axis using the specified node as the origin.

Parameters:
node - The origin node.

getDescendantOrSelfAxis

java.lang.Iterable<N> getDescendantOrSelfAxis(N node)
Returns the nodes along the descendant-or-self axis using the specified node as the origin.

Parameters:
node - The origin node.

getFirstChildElement

N getFirstChildElement(N node)
Returns the first element along the child axis.

Parameters:
node - The parent node that owns the child axis.

getFirstChildElementByName

N getFirstChildElementByName(N node,
                             java.lang.String namespaceURI,
                             java.lang.String localName)
Returns the first child element along the child axis whose name matches the arguments supplied.

Parameters:
node - The parent node that owns the child axis.
namespaceURI - The namespace-uri to be matched.
localName - The local-name to be matched.

getFollowingAxis

java.lang.Iterable<N> getFollowingAxis(N node)
Returns the nodes along the following axis using the specified node as the origin.

Parameters:
node - The origin node.

getFollowingSiblingAxis

java.lang.Iterable<N> getFollowingSiblingAxis(N node)
Returns the nodes along the following-sibling axis using the specified node as the origin.

Parameters:
node - The origin node.

getLineNumber

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


getNamespaceAxis

java.lang.Iterable<N> getNamespaceAxis(N node,
                                       boolean inherit)
Returns the nodes along the namespace axis using the specified node as the origin.

The namespace axis contains the namespace nodes of the context node; the axis will be empty unless the context node is an element.

Parameters:
node - The origin node.
inherit - Determines whether in-scope prefix mappings will be included in the result. The standard setting for this parameter is true.

getNextSiblingElement

N getNextSiblingElement(N node)
Returns the next element along the child axis.

Parameters:
node - The node for which the next sibling node is required.

getNextSiblingElementByName

N getNextSiblingElementByName(N node,
                              java.lang.String namespaceURI,
                              java.lang.String localName)
Returns the next element along the following-sibling axis whose name matches the arguments supplied.

Parameters:
node - The node for which the next sibling node is required.
namespaceURI - The namespace-uri to be matched.
localName - The local-name to be matched.

getPrecedingAxis

java.lang.Iterable<N> getPrecedingAxis(N node)
Returns the nodes along the preceding axis using the specified node as the origin.

Parameters:
node - The origin node.

getPrecedingSiblingAxis

java.lang.Iterable<N> getPrecedingSiblingAxis(N node)
Returns the nodes along the preceding-sibling axis using the specified node as the origin.

Parameters:
node - The origin node.

getRoot

N getRoot(N node)
Returns the identity of the top-most node along the ancestor-or-self axis from this node.

Parameters:
node - The node from which to begin the search for the top-most node.

write

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

Parameters:
node - The node to be streamed.
writer - The handler for the events generated.
Throws:
java.io.IOException


Copyright © 2009 TIBCO Software Inc. All Rights Reserved.