org.apache.commons.configuration
Class XMLConfiguration.XMLBuilderVisitor

java.lang.Object
  extended by org.apache.commons.configuration.HierarchicalConfiguration.NodeVisitor
      extended by org.apache.commons.configuration.HierarchicalConfiguration.BuilderVisitor
          extended by org.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, char listDelimiter)
          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.
 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, char listDelimiter)
          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,
                                          char listDelimiter)
Creates a new instance of XMLBuilderVisitor

Parameters:
doc - the document to be created
listDelimiter - the delimiter for attribute properties with multiple values
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)
Inserts a new node. This implementation ensures that the correct XML element is created and inserted between the given siblings.

Specified by:
insert in class HierarchicalConfiguration.BuilderVisitor
Parameters:
newNode - the node to insert
parent - the parent node
sibling1 - the first sibling
sibling2 - the second sibling
Returns:
the new node

updateAttribute

static void updateAttribute(HierarchicalConfiguration.Node node,
                            String name,
                            char listDelimiter)
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
listDelimiter - the delimiter vor attributes with multiple values


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