1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
private static Document doc;
private static Element index;
public static void main(String[] args) {
SAXBuilder builder = new SAXBuilder();
try {
doc = builder.build(new File("carte.xml"));
} catch (JDOMException e) {
System.err.println("Erreur syntaxe");
} catch (IOException e) {
System.err.println("Erreur d'I/O ...");
}
index = doc.getRootElement();
// On cree une liste contenat tout les noeuds param
List param = index.getChildren("param");
Iterator it = param.iterator();
while(it.hasNext()) {
Element courant = (Element) it.next();
System.out.println(courant.getText());
Integer i = new Integer(courant.getText());
Integer j = new Integer(courant.getText());
RectangularBoard theboard = new RectangularBoard(i,j);
theboard.init(null);
}
}
} |
Partager