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

Comparing projects/cms/source/host/c++/XMLFormatter.cpp (file contents):
Revision 1.5 by ab11, Fri Mar 23 14:07:11 2001 UTC vs.
Revision 1.6 by ab11, Fri Mar 23 16:38:34 2001 UTC

# Line 2 | Line 2
2  
3   XMLFormatter::XMLFormatter( string newHostInfo ){
4          // std::cout << "DEBUG: " << newHostInfo << "\n";
5 <        xmlData += "<";
6 <        xmlData += newHostInfo;
7 <        xmlData += ">";
5 >        if ( newHostInfo != "" ){
6          
7 <        hostInfo = newHostInfo;
8 <        // std::cout << "DEBUG: xmldata: " << xmlData << "\n";
9 <        
7 >        xmlData += "<";
8 >        xmlData += newHostInfo;
9 >        xmlData += ">";
10 >        
11 >        hostInfo = newHostInfo;
12 >        // std::cout << "DEBUG: xmldata: " << xmlData << "\n";
13 >        }
14          stackPointer = 0;
15   }
16  
# Line 47 | Line 49 | void XMLFormatter::closeNest(){
49  
50   void XMLFormatter::addNest(string nest){
51          // std::cout << "DEBUG: Adding Nest: " << nest << "\n";
50        xmlData += "<";
51        xmlData += nest;
52        xmlData += ">";
52          
53 <        // now add the nest to the stack
54 <        stack[stackPointer] = nest;
55 <        stackPointer++;
56 <        return;
53 >        // check it is not empty
54 >        if ( nest != "" ){
55 >        xmlData += "<";
56 >        xmlData += nest;
57 >        xmlData += ">";
58 >        
59 >        // now add the nest to the stack
60 >        stack[stackPointer] = nest;
61 >        stackPointer++;
62 >    } // if
63 >    
64 >    return;    
65   }
66  
67   void XMLFormatter::addElement(string element, string attributes, string value){
# Line 64 | Line 71 | void XMLFormatter::addElement(string element, string a
71          xmlData += " ";
72          xmlData += attributes;
73          xmlData += ">";
74 <        if ( value != "" ){
74 >        xmlData += value;
75 >        xmlData += "</";
76 >        xmlData += element;
77 >        xmlData += ">";
78 >
79 >    return;
80 > }
81 >
82 > void XMLFormatter::addElement(string element, string value){
83 >        // std::cout << "DEBUG: Add Element: " << element << ":" << value << "\n";
84 >        
85 >        if (( element != "" ) && ( value != "" )){
86 >        xmlData += "<";
87 >        xmlData += element;
88 >        xmlData += ">";
89          xmlData += value;
90          xmlData += "</";
91          xmlData += element;
92          xmlData += ">";
93      } // if
94      return;
74 }
75
76 void XMLFormatter::addElement(string element, string value){
77        // std::cout << "DEBUG: Add Element: " << element << ":" << value << "\n";
78        xmlData += "<";
79        xmlData += element;
80        xmlData += ">";
81        xmlData += value;
82        xmlData += "</";
83        xmlData += element;
84        xmlData += ">";
85        return;
95   }
96  
97  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines