org.apache.commons.configuration
Class XMLConfiguration.XMLNode

java.lang.Object
  extended by org.apache.commons.configuration.tree.DefaultConfigurationNode
      extended by org.apache.commons.configuration.HierarchicalConfiguration.Node
          extended by org.apache.commons.configuration.XMLConfiguration.XMLNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ConfigurationNode
Enclosing class:
XMLConfiguration

 class XMLConfiguration.XMLNode
extends HierarchicalConfiguration.Node

A specialized Node class that is connected with an XML element. Changes on a node are also performed on the associated element.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.commons.configuration.tree.DefaultConfigurationNode
DefaultConfigurationNode.SubNodes
 
Field Summary
private static long serialVersionUID
          The serial version UID.
 
Constructor Summary
XMLConfiguration.XMLNode(java.lang.String name, org.w3c.dom.Element elem)
          Creates a new instance of XMLNode and initializes it with a name and the corresponding XML element.
 
Method Summary
private  org.w3c.dom.Text findTextNodeForUpdate()
          Returns the only text node of this element for update.
protected  void removeReference()
          Updates the associated XML elements when a node is removed.
 void setValue(java.lang.Object value)
          Sets the value of this node.
private  void updateAttribute()
          Updates the node's value if it represents an attribute.
private  void updateElement(java.lang.Object value)
          Updates the node's value if it represents an element node.
 
Methods inherited from class org.apache.commons.configuration.HierarchicalConfiguration.Node
addChild, getParent, hasChildren, remove, remove, setParent, visit
 
Methods inherited from class org.apache.commons.configuration.tree.DefaultConfigurationNode
addAttribute, addChild, checkState, clone, createSubNodes, getAttribute, getAttributeCount, getAttributeCount, getAttributes, getAttributes, getChild, getChildren, getChildren, getChildrenCount, getChildrenCount, getName, getParentNode, getReference, getValue, isAttribute, isDefined, removeAttribute, removeAttribute, removeAttributes, removeChild, removeChild, removeChildren, setAttribute, setName, setParentNode, setReference, visit
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
The serial version UID.

See Also:
Constant Field Values
Constructor Detail

XMLConfiguration.XMLNode

public XMLConfiguration.XMLNode(java.lang.String name,
                                org.w3c.dom.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

setValue

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

Specified by:
setValue in interface ConfigurationNode
Overrides:
setValue in class DefaultConfigurationNode
Parameters:
value - the node's new value

removeReference

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

Overrides:
removeReference in class DefaultConfigurationNode

updateElement

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

Parameters:
value - the new value

updateAttribute

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


findTextNodeForUpdate

private org.w3c.dom.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