com.raritantechnologies.utils.tree
Class TreeXMLGenerator

java.lang.Object
  extended bycom.raritantechnologies.utils.tree.TreeXMLGenerator
All Implemented Interfaces:
IConfigurable, ITreeProcessor, ITreeXMLGenerator

public class TreeXMLGenerator
extends java.lang.Object
implements IConfigurable, ITreeXMLGenerator, ITreeProcessor

Generates XML from a TreeRoot object.

Generates "flat" tree XML in which each node is related to its parent node by a parent attribute pointer using the TreeNode ID as the node connector (see example below). XML files produced by this object can be read back into TreeRoot objects by the XMLTreeBuilder class.

XML Configuration Template:
   <TreeXMLGenerator class="com.raritantechnologies.utils.tree.TreeXMLGenerator"
                          rootTagName="[ tag name of root tag ]"
                        nodeTagName="[ tag name of result nodes ]"
                        parentTagName="[ tag name of parent tag ]" >
                        multiValueDelimiter="[ optional delimiter for multi value attributes ]"
                        excludedAttributes="[ comma separated list of attributes to be excluded from XML output ]"
                        printPath="[true|false(default) ]" 
                        fileName="[ name of output file ]"
                        hierarchicalTree="[true|false(default) ]" />
 

Sample XML output:


 

Developed by Raritan Technologies Inc..

Author:
Ted Sullivan

Constructor Summary
TreeXMLGenerator()
           
TreeXMLGenerator(java.lang.String excludedAttributes)
           
TreeXMLGenerator(java.lang.String[] excludedAttributes)
           
TreeXMLGenerator(java.lang.String rootTagName, java.lang.String nodeTagName, java.lang.String parentTagName)
           
 
Method Summary
 java.lang.String getXML(TreeNode node)
           
 java.lang.String getXML(TreeNode node, boolean isHierarchical)
           
 java.lang.String getXML(TreeRoot tree)
          returns an XML string that represents data in a TreeRoot object.
 java.lang.String getXML(TreeRoot tree, boolean isHierarchical)
           
 void initialize(org.w3c.dom.Element elem)
          Initializes the object from an XML tag or element.
 void processTree(TreeRoot tree)
           
 void setMultiValueDelimiter(java.lang.String delimiter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeXMLGenerator

public TreeXMLGenerator()

TreeXMLGenerator

public TreeXMLGenerator(java.lang.String[] excludedAttributes)

TreeXMLGenerator

public TreeXMLGenerator(java.lang.String excludedAttributes)

TreeXMLGenerator

public TreeXMLGenerator(java.lang.String rootTagName,
                        java.lang.String nodeTagName,
                        java.lang.String parentTagName)
Method Detail

processTree

public void processTree(TreeRoot tree)
Specified by:
processTree in interface ITreeProcessor

initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IConfigurable
Initializes the object from an XML tag or element. This method is called by the Framework as part of the application initializtion. see ConfigurationManager, XMLConfigurationManager, XMLSearchFieldMapFactory, XMLSearchSourceFactory. Configurable objects that are owned or contained by other configurable objects will be initialized in by the parent object.

Specified by:
initialize in interface IConfigurable

getXML

public java.lang.String getXML(TreeRoot tree)
Description copied from interface: ITreeXMLGenerator
returns an XML string that represents data in a TreeRoot object.

Specified by:
getXML in interface ITreeXMLGenerator

getXML

public java.lang.String getXML(TreeRoot tree,
                               boolean isHierarchical)

getXML

public java.lang.String getXML(TreeNode node)

getXML

public java.lang.String getXML(TreeNode node,
                               boolean isHierarchical)

setMultiValueDelimiter

public void setMultiValueDelimiter(java.lang.String delimiter)