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 |
|
|
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){ |
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 |
|
|