ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/java/XMLFormatter.java
(Generate patch)

Comparing projects/cms/source/host/java/XMLFormatter.java (file contents):
Revision 1.1 by ab11, Mon Nov 27 19:44:00 2000 UTC vs.
Revision 1.4 by ab11, Fri Dec 8 12:21:11 2000 UTC

# Line 31 | Line 31 | class XMLFormatter {
31      * Takes in one arguement which can contain any valid non xml character ( "<",">" )
32      * an example for rootInfo would be "Host"
33      */
34 <    public XMLFormatter(String rootInfo){
34 >    public XMLFormatter(String rootInfo, String attributes){
35  
36          myStack = new Stack();
37          xmlData = new String();
38 +        xmlData = "<"+rootInfo+" "+attributes+">";
39 +        hostInfo = rootInfo;
40 +    }
41 +
42 +    /**
43 +    * Public Constructor for the class
44 +    * Takes in one arguement which can contain any valid non xml character ( "<",">" )
45 +    * an example for rootInfo would be "Host"
46 +    */
47 +    public XMLFormatter(String rootInfo){
48 +        myStack = new Stack();
49 +        xmlData = new String();
50          xmlData = "<"+rootInfo+">";
51          hostInfo = rootInfo;
52      }
# Line 49 | Line 61 | class XMLFormatter {
61          hostInfo = null;
62      }        
63  
64 +    /**
65 +    * Public Constructor for the class
66 +    * Takes a second parameter containing the root attributes.
67 +    */
68 +    public XMLFormatter(String rootInfo, String rootAttributes){
69 +        myStack = new Stack();
70 +        xmlData = new String();
71 +        xmlData = "<"+rootInfo+" "+rootAttributes+">";
72 +        hostInfo = rootInfo;
73 +    }
74  
75   //---PUBLIC METHODS---
76  
77     /**
78 +   * addEement, adds an element to the XML string with attributes
79 +   *
80 +   */
81 +   public void addElement(String name, String attributes, String value){
82 +        // check that the strings contain valid data first
83 +        if (( name.length() != 0 ) && ( value.length() != 0 )){
84 +            xmlData += "<"+name+" "+attributes+">"+value+"</"+name+">";
85 +        }
86 +    }
87 +
88 +   /**
89     * addEement, adds an element to the XML string
90     *
91     */
# Line 72 | Line 105 | class XMLFormatter {
105          xmlData += "<"+name+">";
106          myStack.push(name);
107      }
108 +
109 +    /**
110 +    * addString, adds a string into the XML packet no further processing is carried out
111 +    */
112 +    public void addString(String name){
113 +        xmlData += name;
114 +    }
115 +
116  
117      /**
118      * closeNest will close the currently opened nest (by writing </nest name> to

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines