Hi,
je suis entrain de parcourir un fichier xml avec Jdom Voila le code de parcourir :
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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
	import java.io.*;
	import org.jdom.*;
	import org.jdom.input.*;
	import org.jdom.filter.*;
	import java.util.List;
	import java.util.Iterator;
 
	public class PremierJdom {
 
	   static org.jdom.Document document;
	   static Element racine;
 
	   public static void main(String[] args)
	   {
	      //On crée une instance de SAXBuilder
	      SAXBuilder sxb = new SAXBuilder();
	      try
	      {
	         //On crée un nouveau document JDOM avec en argument le fichier XML
	         //Le parsing est terminé ;)
	         document = sxb.build(new File("Example.wsdl"));
	      }
	      catch(Exception e){}
 
	      //On initialise un nouvel élément racine avec l'élément racine du document.
	      racine = document.getRootElement();
	      //System.out.println(racine.getName());
 
	      //Méthode définie dans la partie 3.2. de cet article
	      afficheALL();
	   }
 
 
	//Ajouter cette méthodes à la classe JDOM2
	static void afficheALL()
	{
	   //On crée une List contenant tous les noeuds "etudiant" de l'Element racine
	   List listEtudiants = racine.getChildren("binding");
 
	   //On crée un Iterator sur notre liste
	   Iterator i = listEtudiants.iterator();
	   while(i.hasNext())
	   {
	      //On recrée l'Element courant à chaque tour de boucle afin de
 
	      Element courant = (Element)i.next();
	      //On affiche le nom de l’élément courant
	      System.out.println(courant.getAttributeValue("name"));
 
	   }
	}
	}
Mais le pribeleme que se pose ici est que lorsqe j'execute cette classe j'aurai aucun sortie.
et voila le fichier Example.wsdl
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
<?xml version="1.0"  encoding= "UTF-8" ?> 
<definitions name= "Web Service Mediation"
 targetNamespace="http://these-info.univ-tun.com/Web Service Mediation " 
xmlns=" http://these-info.univ-tun.comstem online"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"  > 
 
  <binding name="ConnTWSAlt" type="wsdlns:SimplePortType">
<soap:binding style="rpc" 
 transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="foo">
<soap:operation soapAction="http://tempuri.org/action/binding.ConnTWSAlt"/>
<input>
<soap:body use="encoded"  
 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding> 
</definitions>
Quelqu'un saurait il m'indiquer comment corriger cette erreur .
Merci pour votre aide.