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