Top Description Fields Constructors Methods
org.dom4j.tree

public Class DefaultAttribute

extends FlyweightAttribute
Class Inheritance
Known Direct Subclasses
org.dom4j.util.UserDataAttribute, org.dom4j.dom.DOMAttribute
Imports
org.dom4j.Element, .Namespace, .QName

DefaultAttribute implements a doubly linked node which supports the parent relationship and is mutable.

Author
James Strachan
Version
$Revision: 1.13 $

Field Summary

Modifier and TypeField and Description
private Element
parent

The parent of this node

Inherited from org.dom4j.tree.FlyweightAttribute:
value

Constructor Summary

AccessConstructor and Description
public
public
public
DefaultAttribute(Element parent, QName qname, String value)

public
DefaultAttribute(String
is the name of the attribute
name
,
String
is the value of the attribute
value
)

Creates the Attribute with the specified local name and value.

public
DefaultAttribute(String
is the name of the attribute
name
,
String
is the value of the attribute
value
,
Namespace
is the namespace of the attribute
namespace
)

Creates the Attribute with the specified local name, value and Namespace.

public
DefaultAttribute(Element
is the parent element
parent
,
String
is the name of the attribute
name
,
String
is the value of the attribute
value
,
Namespace
is the namespace of the attribute
namespace
)

Creates the Attribute with the specified local name, value and Namespace.

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
setValue(String
is the new value of this attribute
value
)

Overrides org.dom4j.tree.AbstractAttribute.setValue.

Implements org.dom4j.Attribute.setValue.

Sets the value of this attribute 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.FlyweightAttribute:
getQNamegetValue

Field Detail

parentback to summary
private Element parent

The parent of this node

Constructor Detail

DefaultAttributeback to summary
public DefaultAttribute(QName qname)
DefaultAttributeback to summary
public DefaultAttribute(QName qname, String value)
DefaultAttributeback to summary
public DefaultAttribute(Element parent, QName qname, String value)
DefaultAttributeback to summary
public DefaultAttribute(String name, String value)

Creates the Attribute with the specified local name and value.

Parameters
name:String

is the name of the attribute

value:String

is the value of the attribute

DefaultAttributeback to summary
public DefaultAttribute(String name, String value, Namespace namespace)

Creates the Attribute with the specified local name, value and Namespace.

Parameters
name:String

is the name of the attribute

value:String

is the value of the attribute

namespace:Namespace

is the namespace of the attribute

DefaultAttributeback to summary
public DefaultAttribute(Element parent, String name, String value, Namespace namespace)

Creates the Attribute with the specified local name, value and Namespace.

Parameters
parent:Element

is the parent element

name:String

is the name of the attribute

value:String

is the value of the attribute

namespace:Namespace

is the namespace of the attribute

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.

setValueback to summary
public void setValue(String value)

Overrides org.dom4j.tree.AbstractAttribute.setValue.

Implements org.dom4j.Attribute.setValue.

Doc from org.dom4j.Attribute.setValue.

Sets the value of this attribute or this method will throw an UnsupportedOperationException if it is read-only.

Parameters
value:String

is the new value of this attribute

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