j'essaye de créer un fichier XML avec DOM sous eclipse voila le code :
/*
* Created on 18 févr. 2009
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.jdm.xml;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
import java.io.*;

public class userprofil {
public static void transformerXml(Document document, String fichier) {
try {
// Création de la source DOM
Source source = new DOMSource(document);

// Création du fichier de sortie
File file = new File(fichier);
Result resultat = new StreamResult(fichier);

// Configuration du transformer
TransformerFactory fabrique = TransformerFactory.newInstance();
Transformer transformer = fabrique.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");

// Transformation
transformer.transform(source, resultat);
}catch(Exception e){
e.printStackTrace();
}
}
public static void main(String[] args){
try{
// Création d'un nouveau DOM
DocumentBuilderFactory fabrique = DocumentBuilderFactory.newInstance();
DocumentBuilder constructeur = fabrique.newDocumentBuilder();
Document document = constructeur.newDocument();

// Propriétés du DOM
document.setXmlVersion("1.0");
document.setXmlStandalone(true);

// Création de l'arborescence du DOM
Element racine = document.createElement("userprofil");
racine.appendChild(document.createComment("Commentaire sous la racine"));

Element PersonnalInformation = document.createElement("PersonnalInformation");
racine.appendChild(PersonnalInformation);

Element nom = document.createElement("nom");
nom.setTextContent("un nom");
PersonnalInformation.appendChild(nom);

Element prenom = document.createElement("prenom");
prenom.setTextContent("un prénom");
PersonnalInformation.appendChild(prenom);

Element adresse = document.createElement("adresse");
adresse.setTextContent("une adresse");
PersonnalInformation.appendChild(adresse);

Element mail = document.createElement("mail");
mail.setTextContent("un mail");
PersonnalInformation.appendChild(mail);

Element UserId = document.createElement("UserId");
UserId.setTextContent("MSSDIN");
PersonnalInformation.appendChild(UserId);

Element LocationInformation = document.createElement("LocationInformation");
racine.appendChild(LocationInformation);

Element Home = document.createElement("Home");
LocationInformation.appendChild(Home);

Element adresse = document.createElement("adresse");
adresse.setTextContent("une adresse");
Home.appendChild(adresse);

Element ville = document.createElement("ville");
ville.setTextContent("une ville");
Home.appendChild(ville);

Element codepostal = document.createElement("codepostal");
codepostal.setTextContent("code postale");
Home.appendChild(codepostal);

Element Work = document.createElement("Work");
LocationInformation.appendChild(Work);

Element adresse = document.createElement("adresse");
adresse.setTextContent("une adresse");
Work.appendChild(adresse);

Element ville = document.createElement("ville");
ville.setTextContent("une ville");
Work.appendChild(ville);

Element codepostal = document.createElement("codepostal");
codepostal.setTextContent("code postale");
Work.appendChild(codepostal);

document.appendChild(racine);
//Sauvegarde du DOM dans un fichier XML
transformerXml(document, "./userprofil.xml");
}catch(Exception e){
e.printStackTrace();
}
}
}

mais ca s'execute pas, j'ai erreur au niveau File file = new File(fichier); il affiche le message File cannot be resolved or is not a type et le message The type java.io.File cannot be resolved. It is indirectly referenced from required .class files

merci d'avance