--- projects/cms/source/host/java/XMLFormatter.java 2000/12/07 23:22:17 1.3 +++ projects/cms/source/host/java/XMLFormatter.java 2000/12/08 12:21:11 1.4 @@ -10,8 +10,8 @@ import java.util.*; * calling returnXML() will return a string containing the xml. * * - * @author $Author: tdb $ - * @version $Id: XMLFormatter.java,v 1.3 2000/12/07 23:22:17 tdb Exp $ + * @author $Author: ab11 $ + * @version $Id: XMLFormatter.java,v 1.4 2000/12/08 12:21:11 ab11 Exp $ */ class XMLFormatter { @@ -20,7 +20,7 @@ class XMLFormatter { /** * The current CVS revision of this class */ - public final String REVISION = "$Revision: 1.3 $"; + public final String REVISION = "$Revision: 1.4 $"; //---STATIC METHODS--- @@ -31,6 +31,19 @@ class XMLFormatter { * Takes in one arguement which can contain any valid non xml character ( "<",">" ) * an example for rootInfo would be "Host" */ + public XMLFormatter(String rootInfo, String attributes){ + + myStack = new Stack(); + xmlData = new String(); + xmlData = "<"+rootInfo+" "+attributes+">"; + hostInfo = rootInfo; + } + + /** + * Public Constructor for the class + * Takes in one arguement which can contain any valid non xml character ( "<",">" ) + * an example for rootInfo would be "Host" + */ public XMLFormatter(String rootInfo){ myStack = new Stack(); xmlData = new String(); @@ -60,6 +73,17 @@ class XMLFormatter { } //---PUBLIC METHODS--- + + /** + * addEement, adds an element to the XML string with attributes + * + */ + public void addElement(String name, String attributes, String value){ + // check that the strings contain valid data first + if (( name.length() != 0 ) && ( value.length() != 0 )){ + xmlData += "<"+name+" "+attributes+">"+value+""; + } + } /** * addEement, adds an element to the XML string