Top Description Fields Constructors Methods
org.dom4j.tree

public Class DefaultNamespace

extends Namespace
Class Inheritance
Known Direct Subclasses
org.dom4j.dom.DOMNamespace
Imports
org.dom4j.Element, .Namespace

DefaultNamespace implements a doubly linked node which supports the parent relationship and is mutable. It is useful when returning results from XPath expressions.

Author
James Strachan
Version
$Revision: 1.16 $

Field Summary

Modifier and TypeField and Description
private Element
parent

The parent of this node

Inherited from org.dom4j.Namespace:
CACHENO_NAMESPACEXML_NAMESPACE

Constructor Summary

AccessConstructor and Description
public
DefaultNamespace(String
is the prefix for this namespace
prefix
,
String
is the URI for this namespace
uri
)

DOCUMENT ME!

public
DefaultNamespace(Element
is the parent element
parent
,
String
is the prefix for this namespace
prefix
,
String
is the URI for this namespace
uri
)

DOCUMENT ME!

Method Summary

Modifier and TypeMethod and Description
protected int

Returns:

the hash code based on the qualified name and the URI of the namespace and the hashCode() of the parent element.
createHashCode
()

Overrides org.dom4j.Namespace.createHashCode.

DOCUMENT ME!
public boolean

Returns:

DOCUMENT ME!
equals
(Object
DOCUMENT ME!
object
)

Overrides org.dom4j.Namespace.equals.

Implements an identity based comparsion using the parent element as well as the prefix and URI
public Element
getParent()

Overrides org.dom4j.tree.AbstractNode.getParent.

Implements org.dom4j.Node.getParent.

getParent returns the parent Element if this node supports the parent relationship or null if it is the root element or does not support the parent relationship.

public int
hashCode()

Overrides org.dom4j.Namespace.hashCode.

DOCUMENT ME!
public boolean
isReadOnly()

Overrides org.dom4j.tree.AbstractNode.isReadOnly.

Implements org.dom4j.Node.isReadOnly.

isReadOnly returns true if this node is read only and cannot be modified.

public void
setParent(Element
is the new parent of this node.
parent
)

Overrides org.dom4j.tree.AbstractNode.setParent.

Implements org.dom4j.Node.setParent.

setParent sets the parent relationship of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.

public boolean
supportsParent()

Overrides org.dom4j.tree.AbstractNode.supportsParent.

Implements org.dom4j.Node.supportsParent.

supportsParent returns true if this node supports the parent relationship.

Inherited from org.dom4j.Namespace:
acceptasXMLcreateXPathResultgetgetgetNodeTypegetPathgetPrefixgetStringValuegetTextgetUniquePathgetURIgetXPathNameSteptoString

Field Detail

parentback to summary
private Element parent

The parent of this node

Constructor Detail

DefaultNamespaceback to summary
public DefaultNamespace(String prefix, String uri)

DOCUMENT ME!

Parameters
prefix:String

is the prefix for this namespace

uri:String

is the URI for this namespace

DefaultNamespaceback to summary
public DefaultNamespace(Element parent, String prefix, String uri)

DOCUMENT ME!

Parameters
parent:Element

is the parent element

prefix:String

is the prefix for this namespace

uri:String

is the URI for this namespace

Method Detail

createHashCodeback to summary
protected int createHashCode()

Overrides org.dom4j.Namespace.createHashCode.

DOCUMENT ME!

Returns:int

the hash code based on the qualified name and the URI of the namespace and the hashCode() of the parent element.

equalsback to summary
public boolean equals(Object object)

Overrides org.dom4j.Namespace.equals.

Implements an identity based comparsion using the parent element as well as the prefix and URI

Parameters
object:Object

DOCUMENT ME!

Returns:boolean

DOCUMENT ME!

getParentback to summary
public Element getParent()

Overrides org.dom4j.tree.AbstractNode.getParent.

Implements org.dom4j.Node.getParent.

Doc from org.dom4j.Node.getParent.

getParent returns the parent Element if this node supports the parent relationship or null if it is the root element or does not support the parent relationship.

This method is an optional feature and may not be supported for all Node implementations.

Returns:Element

the parent of this node or null if it is the root of the tree or the parent relationship is not supported.

hashCodeback to summary
public int hashCode()

Overrides org.dom4j.Namespace.hashCode.

Doc from org.dom4j.Namespace.hashCode.

DOCUMENT ME!

Returns:int

the hash code based on the qualified name and the URI of the namespace.

isReadOnlyback to summary
public boolean isReadOnly()

Overrides org.dom4j.tree.AbstractNode.isReadOnly.

Implements org.dom4j.Node.isReadOnly.

Doc from org.dom4j.Node.isReadOnly.

isReadOnly returns true if this node is read only and cannot be modified. Any attempt to modify a read-only Node will result in an UnsupportedOperationException being thrown.

Returns:boolean

true if this Node is read only and cannot be modified otherwise false.

setParentback to summary
public void setParent(Element parent)

Overrides org.dom4j.tree.AbstractNode.setParent.

Implements org.dom4j.Node.setParent.

Doc from org.dom4j.Node.setParent.

setParent sets the parent relationship of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.

This method should only be called from inside an Element implementation method and is not intended for general use.

Parameters
parent:Element

is the new parent of this node.

supportsParentback to summary
public boolean supportsParent()

Overrides org.dom4j.tree.AbstractNode.supportsParent.

Implements org.dom4j.Node.supportsParent.

Doc from org.dom4j.Node.supportsParent.

supportsParent returns true if this node supports the parent relationship.

Some XML tree implementations are singly linked and only support downward navigation through children relationships. The default case is that both parent and children relationships are supported though for memory and performance reasons the parent relationship may not be supported.

Returns:boolean

true if this node supports the parent relationship or false it is not supported