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

Class DOMNodePointer

Implemented Interfaces:
Cloneable, Comparable, Pointer, Serializable

public class DOMNodePointer
extends NodePointer

A Pointer that points to a DOM node.
Version:
$Revision: 1.24 $ $Date: 2004/06/29 22:58:17 $
Author:
Dmitri Plotnikov

Field Summary

static String
XMLNS_NAMESPACE_URI
static String
XML_NAMESPACE_URI

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

UNKNOWN_NAMESPACE, WHOLE_COLLECTION, index, locale, parent

Constructor Summary

DOMNodePointer(Node node, Locale locale)
DOMNodePointer(Node node, Locale locale, String id)
DOMNodePointer(NodePointer parent, Node node)

Method Summary

String
asPath()
NodeIterator
attributeIterator(QName name)
NodeIterator
childIterator(NodeTest test, boolean reverse, NodePointer startWith)
int
compareChildNodePointers(NodePointer pointer1, NodePointer pointer2)
NodePointer
createAttribute(JXPathContext context, QName name)
NodePointer
createChild(JXPathContext context, QName name, int index)
NodePointer
createChild(JXPathContext context, QName name, int index, Object value)
boolean
equals(Object object)
Object
getBaseValue()
String
getDefaultNamespaceURI()
Object
getImmediateNode()
protected String
getLanguage()
int
getLength()
static String
getLocalName(Node node)
QName
getName()
String
getNamespaceURI()
static String
getNamespaceURI(Node node)
String
getNamespaceURI(String prefix)
Pointer
getPointerByID(JXPathContext context, String id)
Locates a node by ID.
static String
getPrefix(Node node)
Object
getValue()
int
hashCode()
boolean
isActual()
boolean
isCollection()
boolean
isLanguage(String lang)
Returns true if the xml:lang attribute for the current node or its parent has the specified prefix lang.
boolean
isLeaf()
NodeIterator
namespaceIterator()
NodePointer
namespacePointer(String prefix)
void
remove()
void
setValue(Object value)
Sets contents of the node to the specified value.
static boolean
testNode(Node node, NodeTest test)
boolean
testNode(NodeTest test)

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

Field Details

XMLNS_NAMESPACE_URI

public static final String XMLNS_NAMESPACE_URI

XML_NAMESPACE_URI

public static final String XML_NAMESPACE_URI

Constructor Details

DOMNodePointer

public DOMNodePointer(Node node,
                      Locale locale)

DOMNodePointer

public DOMNodePointer(Node node,
                      Locale locale,
                      String id)

DOMNodePointer

public DOMNodePointer(NodePointer parent,
                      Node node)

Method Details

asPath

public String asPath()
Specified by:
asPath in interface Pointer
Overrides:
asPath in interface NodePointer

attributeIterator

public NodeIterator attributeIterator(QName name)
Overrides:
attributeIterator in interface NodePointer

childIterator

public NodeIterator childIterator(NodeTest test,
                                  boolean reverse,
                                  NodePointer startWith)
Overrides:
childIterator in interface NodePointer

compareChildNodePointers

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

createAttribute

public NodePointer createAttribute(JXPathContext context,
                                   QName name)
Overrides:
createAttribute in interface NodePointer

createChild

public NodePointer createChild(JXPathContext context,
                               QName name,
                               int index)
Overrides:
createChild in interface NodePointer

createChild

public NodePointer createChild(JXPathContext context,
                               QName name,
                               int index,
                               Object value)
Overrides:
createChild in interface NodePointer

equals

public boolean equals(Object object)

getBaseValue

public Object getBaseValue()
Overrides:
getBaseValue in interface NodePointer

getDefaultNamespaceURI

public String getDefaultNamespaceURI()
Overrides:
getDefaultNamespaceURI in interface NodePointer

getImmediateNode

public Object getImmediateNode()
Overrides:
getImmediateNode in interface NodePointer

getLanguage

protected String getLanguage()

getLength

public int getLength()
Overrides:
getLength in interface NodePointer

getLocalName

public static String getLocalName(Node node)

getName

public QName getName()
Overrides:
getName in interface NodePointer

getNamespaceURI

public String getNamespaceURI()
Overrides:
getNamespaceURI in interface NodePointer

getNamespaceURI

public static String getNamespaceURI(Node node)

getNamespaceURI

public String getNamespaceURI(String prefix)
Overrides:
getNamespaceURI in interface NodePointer

getPointerByID

public Pointer getPointerByID(JXPathContext context,
                              String id)
Locates a node by ID.
Overrides:
getPointerByID in interface NodePointer

getPrefix

public static String getPrefix(Node node)

getValue

public Object getValue()
Specified by:
getValue in interface Pointer
Overrides:
getValue in interface NodePointer

hashCode

public int hashCode()

isActual

public boolean isActual()
Overrides:
isActual in interface NodePointer

isCollection

public boolean isCollection()
Overrides:
isCollection in interface NodePointer

isLanguage

public boolean isLanguage(String lang)
Returns true if the xml:lang attribute for the current node or its parent has the specified prefix lang. If no node has this prefix, calls super.isLanguage(lang).
Overrides:
isLanguage in interface NodePointer

isLeaf

public boolean isLeaf()
Overrides:
isLeaf in interface NodePointer

namespaceIterator

public NodeIterator namespaceIterator()
Overrides:
namespaceIterator in interface NodePointer

namespacePointer

public NodePointer namespacePointer(String prefix)
Overrides:
namespacePointer in interface NodePointer

remove

public void remove()
Overrides:
remove in interface NodePointer

setValue

public void setValue(Object value)
Sets contents of the node to the specified value. If the value is a String, the contents of the node are replaced with this text. If the value is an Element or Document, the children of the node are replaced with the children of the passed node.
Specified by:
setValue in interface Pointer
Overrides:
setValue in interface NodePointer

testNode

public static boolean testNode(Node node,
                               NodeTest test)

testNode

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