Bonjour,
Je débute dans la progrommation Java/XML, j'ai donc appliqué le tutoriel approprié.
Cependant j'obtiens l'erreur suivante, et je n'ai pas trouvé cela dans les autres topics...

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
 
Exception in thread "AWT-EventQueue-0" java.lang.VerifyError: (class: dvdorganizer/XMLAccess, method: startElement signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lorg/xml/sax/Attributes;)V) Incompatible object argument for function call
	at dvdorganizer.ConnectionSelector.jButtonOK_actionPerformed(ConnectionSelector.java:417)
	at dvdorganizer.ConnectionSelector$11.actionPerformed(ConnectionSelector.java:230)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Voici mon code :
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
 
      try {
        SAXParserFactory fabrique = SAXParserFactory.newInstance();
        SAXParser parseur = fabrique.newSAXParser();
        File fichier = new File("./Films.xml");
        XMLAccess xmlAccess = new XMLAccess();
        parseur.parse (fichier, xmlAccess);
      } catch(ParserConfigurationException pce){
         System.out.println("Erreur de configuration du parseur");
         System.out.println("Lors de l'appel à newSAXParser()");
      } catch(SAXException se){
         System.out.println("Erreur de parsing");
         System.out.println("Lors de l'appel à parse()");
      } catch(IOException ioe){
         System.out.println("Erreur d'entrée-sortie");
         System.out.println("Lors de l'appel à parse()");
      }
et la définition de ma fonction StartElement :

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
 
   //détection d'ouverture de balise
   public void startElement (String uri, String rawName, String qName, Attributes attributes) throws SAXException {
      if (qName.equals ("Films")) {
         listFilms = new LinkedList/*<Film>*/();
         inFilms = true;
      } else if (qName.equals ("Film")) {
         film = new FilmXML();
         try {
            int id = Integer.parseInt (attributes.getValue ("FilmID"));
            film.setNewID (id);
         } catch (Exception e) { //erreur, le contenu de id n'est pas un entier
            throw new SAXException (e);
         }
         inFilm = true;
      } else {
         buffer = new StringBuffer();
         if (qName.equals ("Titre")){
            inTitre = true;
         } else if (qName.equals("Réalisateur")){
            inRéalisateur = true;
         } else if (qName.equals("Acteurs")){
            inRéalisateur = true;
         } else if (qName.equals("Année")){
            inRéalisateur = true;
         } else if (qName.equals("Durée")){
            inRéalisateur = true;
         } else if (qName.equals("GenreID")){
            inRéalisateur = true;
         } else if (qName.equals("FormatID")){
            inRéalisateur = true;
         } else if (qName.equals("Prêt")){
            inRéalisateur = true;
         } else if (qName.equals("PosterPath")){
            inRéalisateur = true;
         } else {
            // erreur, on peut lever une exception
            throw new SAXException ("Balise " + qName + " inconnue.");
         }
      }
   }