1 |
tdb |
1.2 |
/* |
2 |
|
|
* i-scream central monitoring system |
3 |
tdb |
1.3 |
* http://www.i-scream.org.uk |
4 |
tdb |
1.2 |
* Copyright (C) 2000-2002 i-scream |
5 |
|
|
* |
6 |
|
|
* This program is free software; you can redistribute it and/or |
7 |
|
|
* modify it under the terms of the GNU General Public License |
8 |
|
|
* as published by the Free Software Foundation; either version 2 |
9 |
|
|
* of the License, or (at your option) any later version. |
10 |
|
|
* |
11 |
|
|
* This program is distributed in the hope that it will be useful, |
12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
* GNU General Public License for more details. |
15 |
|
|
* |
16 |
|
|
* You should have received a copy of the GNU General Public License |
17 |
|
|
* along with this program; if not, write to the Free Software |
18 |
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 |
|
|
*/ |
20 |
|
|
|
21 |
ab11 |
1.1 |
class XMLFormattertest { |
22 |
|
|
|
23 |
|
|
public static void main( String[] args ){ |
24 |
|
|
// create the XMLFormatter |
25 |
|
|
|
26 |
|
|
XMLFormatter test = new XMLFormatter("Hostname"); |
27 |
|
|
|
28 |
|
|
// add a few elements to the root node |
29 |
|
|
test.addElement("Element1","Value1"); |
30 |
|
|
test.addElement("Element2","Value2"); |
31 |
|
|
test.addElement("Element3","Value3"); |
32 |
|
|
|
33 |
|
|
// add a nest |
34 |
|
|
test.addNest("Nest1"); |
35 |
|
|
// add a few elements within that nest |
36 |
|
|
test.addElement("Nest1Element1","Value1"); |
37 |
|
|
test.addElement("Nest1Element2","Value2"); |
38 |
|
|
test.addElement("Nest1Element3","Value3"); |
39 |
|
|
// add another nest |
40 |
|
|
test.addNest("Nest2"); |
41 |
|
|
// add one element |
42 |
|
|
test.addElement("Nest2Element1","Value1"); |
43 |
|
|
// close this nest |
44 |
|
|
test.closeNest(); |
45 |
|
|
// add another element; |
46 |
|
|
test.addElement("Nest1Element4","Value4"); |
47 |
|
|
test.closeNest(); |
48 |
|
|
|
49 |
|
|
// add one more element |
50 |
|
|
test.addElement("Element4","Value4"); |
51 |
|
|
|
52 |
|
|
System.out.println("'"+test.returnXML()+"'"); |
53 |
|
|
|
54 |
|
|
} |
55 |
|
|
|
56 |
|
|
} |