bonjour à tous,

j'essaye de filtrer les publicités d'un site dans le cadre d'un projet de fin d'étude mais je n'y arrive pas .
voilà 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
XPath xpa = XPath.newInstance("//a[@href]");
List results = xpa.selectNodes(racine) ;
Iterator iter = results.iterator() ;
org.jdom.Element noeudCourant = null;
while (iter.hasNext()){
    noeudCourant = (org.jdom.Element) iter.next();
    String attribut=xpa.valueOf(noeudCourant);
    Matcher matcher = Pattern.compile("http://www.pub*").matcher(attribut);
	if (matcher.find()) 
	{
    racine.removeContent(noeudCourant);
	}
 
}
ensuite pour enregistrer mon fichier je fais ça :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
sortie.output(documentJDOM, new FileOutputStream("C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/FATMA/CLIENTS/"+log+"/sanspub.xml"));
rien ne se passe. ou est ce que j'ai commis une faute?
merci pour vos réponse