I'm new to using JDOM2 with java and i don't find how to not repeat the open tag of xml
this look like this in the xml file when i created my "compte" :
<?xml version="1.0" encoding="UTF-8"?>
<banque>
<compte>
<numCompte>4465</numCompte>
<nom>Antoine</nom>
<solde>1684185</solde>
</compte>
</banque><?xml version="1.0" encoding="UTF-8"?>
<banque>
<compte id="0102">
<numCompte>0102</numCompte>
<nom>rzrzr</nom>
<solde>85416</solde>
</compte>
</banque>
this is the Java :
Element banque = new Element("banque");
Document document = new Document(banque);
Element compte = new Element("compte");
compte.setAttribute(new Attribute("id", this.idCompte));
compte.addContent(new Element("numCompte").setText(this.idCompte));
compte.addContent(new Element("nom").setText(this.nom));
compte.addContent(new Element("solde").setText(this.solde));
document.getRootElement().addContent(compte);
XMLOutputter xmlOutput = new XMLOutputter();
xmlOutput.output(document, System.out);
xmlOutput.setFormat(Format.getPrettyFormat());
xmlOutput.output(document, new FileWriter(
"generatedXmlFiles/listeCompte.xml",true));
thanks for your time :)
I've find the solution :