Top Description Fields Constructors Methods
org.dom4j.tree

public Class DefaultText

extends FlyweightText
Class Inheritance
Known Direct Subclasses
org.dom4j.dom.DOMText
Imports
org.dom4j.Element

DefaultText is the default Text implementation. It is a doubly linked node which supports the parent relationship and can be modified in place.

Author
James Strachan
Version
$Revision: 1.11 $

Field Summary

Modifier and TypeField and Description
private Element
parent

The parent of this node

Inherited from org.dom4j.tree.FlyweightText:
text

Constructor Summary

AccessConstructor and Description
public
DefaultText(String
is the Text text
text
)

DOCUMENT ME!

public
DefaultText(Element
is the parent element
parent
,
String
is the Text text
text
)

DOCUMENT ME!

Method Summary

Modifier and TypeMethod and Description
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 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 void
setText(String
is the new textual value of this node
text
)

Overrides org.dom4j.tree.AbstractNode.setText.

Implements org.dom4j.Node.setText.

Sets the text data of this node or this method will throw an UnsupportedOperationException if it is read-only.

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.tree.FlyweightText:
createXPathResultgetText

Field Detail

parentback to summary
private Element parent

The parent of this node

Constructor Detail

DefaultTextback to summary
public DefaultText(String text)

DOCUMENT ME!

Parameters
text:String

is the Text text

DefaultTextback to summary
public DefaultText(Element parent, String text)

DOCUMENT ME!

Parameters
parent:Element

is the parent element

text:String

is the Text text

Method Detail

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.

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.

setTextback to summary
public void setText(String text)

Overrides org.dom4j.tree.AbstractNode.setText.

Implements org.dom4j.Node.setText.

Doc from org.dom4j.Node.setText.

Sets the text data of this node or this method will throw an UnsupportedOperationException if it is read-only.

Parameters
text:String

is the new textual value 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