org.apache.commons.configuration

Class XMLConfiguration.XMLNode

class XMLConfiguration.XMLNode extends Node

A specialized Node class that is connected with an XML element. Changes on a node are also performed on the associated element.
Field Summary
static longserialVersionUID
The serial version UID.
Constructor Summary
XMLNode(String name, Element elem)
Creates a new instance of XMLNode and initializes it with a name and the corresponding XML element.
Method Summary
TextfindTextNodeForUpdate()
Returns the only text node of this element for update.
protected voidremoveReference()
Updates the associated XML elements when a node is removed.
voidsetValue(Object value)
Sets the value of this node.
voidupdateAttribute()
Updates the node's value if it represents an attribute.
voidupdateElement(Object value)
Updates the node's value if it represents an element node.

Field Detail

serialVersionUID

private static final long serialVersionUID
The serial version UID.

Constructor Detail

XMLNode

public XMLNode(String name, Element elem)
Creates a new instance of XMLNode and initializes it with a name and the corresponding XML element.

Parameters: name the node's name elem the XML element

Method Detail

findTextNodeForUpdate

private Text findTextNodeForUpdate()
Returns the only text node of this element for update. This method is called when the element's text changes. Then all text nodes except for the first are removed. A reference to the first is returned or null if there is no text node at all.

Returns: the first and only text node

removeReference

protected void removeReference()
Updates the associated XML elements when a node is removed.

setValue

public void setValue(Object value)
Sets the value of this node. If this node is associated with an XML element, this element will be updated, too.

Parameters: value the node's new value

updateAttribute

private void updateAttribute()
Updates the node's value if it represents an attribute.

updateElement

private void updateElement(Object value)
Updates the node's value if it represents an element node.

Parameters: value the new value