bonsoir
je veux ecrire un code java qui me permet de parser un fichier xsd
le probleme que mon code n'affiche que le premier attribut du premier element: voici mon code:
Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 public void bar(Document document) throws DocumentException { Element root = document.getRootElement(); // iterate through child elements of root for ( Iterator i = root.elementIterator(); i.hasNext();) { Element element = (Element) i.next(); // do something System.out.println(element.getName()); // System.out.println(element.getData()); System.out.println(element.attributeCount()); if (element.attributeCount()>=1) for(int compt=1;compt<element.attributeCount();compt++) { System.out.println(element.attribute(compt).getName()); System.out.println(element.attribute(compt).getData()); } } }
Partager