no save
Assistance
Achat
News

Forum | programmation
Problème parsing XML avec java
stéphane, le jeu. 25 mars 2004 à 11:05:27
bonjour,

je cherche à parser un document xml contenu sur mon disque dur pour en recup les données.Et j'ai plusieur question.

-Comment faire parser un fichier contenu sur mon DD?

-sinon j'ai trouvé quelque script d'exemple mais ca me marque un message d'erreur:

java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)
at MyParser.<init>(MyParser.java:10)
at MyParser.main(MyParser.java:20)

import java.io.IOException;
import org.apache.*
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;



public class SimpleSaxParser {
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();
}
}
}



et je comprend pas trop le problème si vous pouvez me donner un coup de main merci


Vincent B
mars 04
Suivant
REPONSES
Vincent B
mars 04
stéphane
mars 04
stéphane
mars 04
Vincent B
mars 04
aphlathon
oct. 08
Version Web
Réalisé par RedShift
no save