erreur lors de la creation du XMLReader
Bonjour a tous,
Je commence a apprendre l'utilisation de SAX et j'ai un probleme avec le tutoriel proposé sur le site : http://smeric.developpez.com/java/cours/xml/sax/
La classe de démarrage d'une lecture de flux donnée est la suivante:
Code:
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
| /*
* Created on 2 nov. 03 with Eclipse for Java
*/
package com.developpez.smeric.xml.sax;
import java.io.IOException;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
/**
* Cette classe est livree tel quel.
* @author smeric
* @version 1.0
*/
public class SimpleSaxParser {
/**
* Contructeur.
*/
public SimpleSaxParser(String uri) throws SAXException, IOException {
XMLReader saxReader = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
saxReader.setContentHandler(new SimpleContentHandler());
saxReader.parse(uri);
}
public static void main(String[] args) {
if (0 == args.length || 2 < args.length) {
System.out.println("Usage : SimpleSaxParser uri [parserClassName]");
System.exit(1);
}
String uri = args[0];
String parserName = null;
if (2 == args.length) {
parserName = args[1];
}
try {
SimpleSaxParser parser = new SimpleSaxParser(uri);
} catch (Throwable t) {
t.printStackTrace();
}
}
} |
or elle me genere une erreur :
Citation:
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)
at SimpleSaxParser.<init>(SimpleSaxParser.java:18)
at SimpleSaxParser.main(SimpleSaxParser.java:38)
Comme je n'y comprend pas grand chose encore, est ce que quelqu'un pourrait m'eclairer?
Ou alors m'indiquer un tutoriel qui fonctionne.
Merci