1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
DocumentBuilderFactory create = DocumentBuilderFactory.newInstance();
DocumentBuilder constructor = create.newDocumentBuilder();
/** reading of the XML file with DOM */
File xml = new File("fichier.xml");
Document document = constructor.parse(xml);
/** root of the XML document (LAUNCHER)*/
root = document.getDocumentElement();
if (root != null) {
/** reading nodes RULE */
NodeList nl = root.getElementsByTagName("imprimante");
for (int i=0;i<nl.getLength();i++) {
// pour obtenir l'élément : nl.item(i); }
nl = root.getElementsByTagName("serveur");
for (int i=0;i<nl.getLength();i++) {
// pour obtenir l'élément : nl.item(i);
} |