1 |
ab11 |
1.1 |
class XMLFormattertest { |
2 |
|
|
|
3 |
|
|
public static void main( String[] args ){ |
4 |
|
|
// create the XMLFormatter |
5 |
|
|
|
6 |
|
|
XMLFormatter test = new XMLFormatter("Hostname"); |
7 |
|
|
|
8 |
|
|
// add a few elements to the root node |
9 |
|
|
test.addElement("Element1","Value1"); |
10 |
|
|
test.addElement("Element2","Value2"); |
11 |
|
|
test.addElement("Element3","Value3"); |
12 |
|
|
|
13 |
|
|
// add a nest |
14 |
|
|
test.addNest("Nest1"); |
15 |
|
|
// add a few elements within that nest |
16 |
|
|
test.addElement("Nest1Element1","Value1"); |
17 |
|
|
test.addElement("Nest1Element2","Value2"); |
18 |
|
|
test.addElement("Nest1Element3","Value3"); |
19 |
|
|
// add another nest |
20 |
|
|
test.addNest("Nest2"); |
21 |
|
|
// add one element |
22 |
|
|
test.addElement("Nest2Element1","Value1"); |
23 |
|
|
// close this nest |
24 |
|
|
test.closeNest(); |
25 |
|
|
// add another element; |
26 |
|
|
test.addElement("Nest1Element4","Value4"); |
27 |
|
|
test.closeNest(); |
28 |
|
|
|
29 |
|
|
// add one more element |
30 |
|
|
test.addElement("Element4","Value4"); |
31 |
|
|
|
32 |
|
|
System.out.println("'"+test.returnXML()+"'"); |
33 |
|
|
|
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
} |