org.apache.commons.jxpath.ri.model.dom

Class NamespacePointer

Implemented Interfaces:
Cloneable, Comparable, Pointer, Serializable

public class NamespacePointer
extends NodePointer

Represents a namespace node.
Version:
$Revision: 1.13 $ $Date: 2004/04/01 02:55:32 $
Author:
Dmitri Plotnikov

Field Summary

Fields inherited from class org.apache.commons.jxpath.ri.model.NodePointer

UNKNOWN_NAMESPACE, WHOLE_COLLECTION, index, locale, parent

Constructor Summary

NamespacePointer(NodePointer parent, String prefix)
NamespacePointer(NodePointer parent, String prefix, String namespaceURI)

Method Summary

String
asPath()
Returns a string that is a proper "canonical" XPath that corresponds to this pointer.
int
compareChildNodePointers(NodePointer pointer1, NodePointer pointer2)
boolean
equals(Object object)
Object
getBaseValue()
Object
getImmediateNode()
int
getLength()
QName
getName()
String
getNamespaceURI()
int
hashCode()
boolean
isCollection()
boolean
isLeaf()
void
setValue(Object value)
Throws UnsupportedOperationException.
boolean
testNode(NodeTest nodeTest)

Methods inherited from class org.apache.commons.jxpath.ri.model.NodePointer

asPath, attributeIterator, childIterator, clone, compareChildNodePointers, compareTo, createAttribute, createChild, createChild, createPath, createPath, getBaseValue, getDefaultNamespaceURI, getImmediateNode, getImmediateParentPointer, getImmediateValuePointer, getIndex, getLength, getLocale, getName, getNamespaceResolver, getNamespaceURI, getNamespaceURI, getNode, getNodeValue, getParent, getPointerByID, getPointerByKey, getRootNode, getValue, getValuePointer, isActual, isAttribute, isCollection, isContainer, isDefaultNamespace, isLanguage, isLeaf, isNode, isRoot, namespaceIterator, namespacePointer, newChildNodePointer, newNodePointer, printPointerChain, remove, setAttribute, setIndex, setNamespaceResolver, setValue, testNode, toString

Constructor Details

NamespacePointer

public NamespacePointer(NodePointer parent,
                        String prefix)

NamespacePointer

public NamespacePointer(NodePointer parent,
                        String prefix,
                        String namespaceURI)

Method Details

asPath

public String asPath()
Returns a string that is a proper "canonical" XPath that corresponds to this pointer. Consider this example:

Pointer ptr = ctx.getPointer("//employees[firstName = 'John']")

The value of ptr.asPath() will look something like "/departments[2]/employees[3]", so, basically, it represents the concrete location(s) of the result of a search performed by JXPath. If an object in the pointer's path is a Dynamic Property object (like a Map), the asPath method generates an XPath that looks like this: " /departments[@name = 'HR']/employees[3]".

Specified by:
asPath in interface Pointer
Overrides:
asPath in interface NodePointer

compareChildNodePointers

public int compareChildNodePointers(NodePointer pointer1,
                                    NodePointer pointer2)
Overrides:
compareChildNodePointers in interface NodePointer

equals

public boolean equals(Object object)

getBaseValue

public Object getBaseValue()
Overrides:
getBaseValue in interface NodePointer

getImmediateNode

public Object getImmediateNode()
Overrides:
getImmediateNode in interface NodePointer

getLength

public int getLength()
Overrides:
getLength in interface NodePointer

getName

public QName getName()
Overrides:
getName in interface NodePointer

getNamespaceURI

public String getNamespaceURI()
Overrides:
getNamespaceURI in interface NodePointer

hashCode

public int hashCode()

isCollection

public boolean isCollection()
Overrides:
isCollection in interface NodePointer

isLeaf

public boolean isLeaf()
Overrides:
isLeaf in interface NodePointer

setValue

public void setValue(Object value)
Throws UnsupportedOperationException.
Specified by:
setValue in interface Pointer
Overrides:
setValue in interface NodePointer

testNode

public boolean testNode(NodeTest nodeTest)
Overrides:
testNode in interface NodePointer