org.apache.commons.configuration
Class XMLConfiguration.XMLBuilderVisitor

java.lang.Object
  extended byorg.apache.commons.configuration.HierarchicalConfiguration.NodeVisitor
      extended byorg.apache.commons.configuration.HierarchicalConfiguration.BuilderVisitor
          extended byorg.apache.commons.configuration.XMLConfiguration.XMLBuilderVisitor
Enclosing class:
XMLConfiguration

static class XMLConfiguration.XMLBuilderVisitor
extends HierarchicalConfiguration.BuilderVisitor

A concrete BuilderVisitor that can construct XML documents.


Constructor Summary
XMLConfiguration.XMLBuilderVisitor(Document doc)
          Creates a new instance of XMLBuilderVisitor
 
Method Summary
protected  Object insert(HierarchicalConfiguration.Node newNode, HierarchicalConfiguration.Node parent, HierarchicalConfiguration.Node sibling1, HierarchicalConfiguration.Node sibling2)
          Inserts a new node into the structure constructed by this builder.
 void processDocument(HierarchicalConfiguration.Node rootNode)
          Processes the node hierarchy and adds new nodes to the document.
(package private) static void updateAttribute(HierarchicalConfiguration.Node node, String name)
          Updates the value of the specified attribute of the given node.
 
Methods inherited from class org.apache.commons.configuration.HierarchicalConfiguration.BuilderVisitor
visitBeforeChildren
 
Methods inherited from class org.apache.commons.configuration.HierarchicalConfiguration.NodeVisitor
terminate, visitAfterChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLConfiguration.XMLBuilderVisitor

public XMLConfiguration.XMLBuilderVisitor(Document doc)
Creates a new instance of XMLBuilderVisitor

Parameters:
doc - the document to be created
Method Detail

processDocument

public void processDocument(HierarchicalConfiguration.Node rootNode)
Processes the node hierarchy and adds new nodes to the document.

Parameters:
rootNode - the root node

insert

protected Object insert(HierarchicalConfiguration.Node newNode,
                        HierarchicalConfiguration.Node parent,
                        HierarchicalConfiguration.Node sibling1,
                        HierarchicalConfiguration.Node sibling2)
Description copied from class: HierarchicalConfiguration.BuilderVisitor
Inserts a new node into the structure constructed by this builder. This method is called for each node that has been added to the configuration tree after the configuration has been loaded from its source. These new nodes have to be inserted into the original structure. The passed in nodes define the position of the node to be inserted: its parent and the siblings between to insert. The return value is interpreted as the new reference of the affected Node object; if it is not null , it is passed to the node's setReference() method.

Specified by:
insert in class HierarchicalConfiguration.BuilderVisitor
Parameters:
newNode - the node to be inserted
parent - the parent node
sibling1 - the sibling after which the node is to be inserted; can be null if the new node is going to be the first child node
sibling2 - the sibling before which the node is to be inserted; can be null if the new node is going to be the last child node
Returns:
the reference object for the node to be inserted

updateAttribute

static void updateAttribute(HierarchicalConfiguration.Node node,
                            String name)
Updates the value of the specified attribute of the given node. Because there can be multiple child nodes representing this attribute the new value is determined by iterating over all those child nodes.

Parameters:
node - the affected node
name - the name of the attribute


Copyright © 2001-2005 The Apache Software Foundation. All Rights Reserved.