| 32 |
|
* an example for rootInfo would be "Host" |
| 33 |
|
*/ |
| 34 |
|
public XMLFormatter(String rootInfo){ |
| 35 |
– |
|
| 35 |
|
myStack = new Stack(); |
| 36 |
|
xmlData = new String(); |
| 37 |
|
xmlData = "<"+rootInfo+">"; |
| 48 |
|
hostInfo = null; |
| 49 |
|
} |
| 50 |
|
|
| 51 |
+ |
/** |
| 52 |
+ |
* Public Constructor for the class |
| 53 |
+ |
* Takes a second parameter containing the root attributes. |
| 54 |
+ |
*/ |
| 55 |
+ |
public XMLFormatter(String rootInfo, String rootAttributes){ |
| 56 |
+ |
myStack = new Stack(); |
| 57 |
+ |
xmlData = new String(); |
| 58 |
+ |
xmlData = "<"+rootInfo+" "+rootAttributes+">"; |
| 59 |
+ |
hostInfo = rootInfo; |
| 60 |
+ |
} |
| 61 |
|
|
| 62 |
|
//---PUBLIC METHODS--- |
| 63 |
|
|
| 81 |
|
xmlData += "<"+name+">"; |
| 82 |
|
myStack.push(name); |
| 83 |
|
} |
| 84 |
+ |
|
| 85 |
+ |
/** |
| 86 |
+ |
* addString, adds a string into the XML packet no further processing is carried out |
| 87 |
+ |
*/ |
| 88 |
+ |
public void addString(String name){ |
| 89 |
+ |
xmlData += name; |
| 90 |
+ |
} |
| 91 |
+ |
|
| 92 |
|
|
| 93 |
|
/** |
| 94 |
|
* closeNest will close the currently opened nest (by writing </nest name> to |