<div dir="ltr"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 11"><meta name="Originator" content="Microsoft Word 11"><link rel="File-List" href="file:///C:%5CUsers%5Cmeriem%5CAppData%5CLocal%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"><style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0cm;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
span.EmailStyle15
        {mso-style-type:personal;
        mso-style-noshow:yes;
        mso-ansi-font-size:10.0pt;
        mso-bidi-font-size:10.0pt;
        font-family:Arial;
        mso-ascii-font-family:Arial;
        mso-hansi-font-family:Arial;
        mso-bidi-font-family:Arial;
        color:windowtext;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;
        mso-header-margin:36.0pt;
        mso-footer-margin:36.0pt;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
<p class="MsoNormal" style=""><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);" lang="EN-GB">I want to delete an element from xml-file. this is my
code but the file dosen't change when I test it.</span></b></p>
<p class="MsoNormal" style=""><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);" lang="EN-GB"> </span></b></p>
<p class="MsoNormal" style=""><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);" lang="EN-GB"> </span></b></p>
<p class="MsoNormal" style=""><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);" lang="EN-GB">public</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"> </span><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);" lang="EN-GB">static</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"> String
supp(){</span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span></span><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);" lang="EN-GB">try</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB">{</span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span></span><i><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 192);" lang="EN-GB">racine</span></i><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB">=</span><i><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 192);" lang="EN-GB">document</span></i><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB">.getRootElement();</span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span>Element
rac=</span><i><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 192);" lang="EN-GB">racine</span></i><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB">.getChild(</span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(42, 0, 255);" lang="EN-GB">"voitures"</span><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB">);</span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span><span style=""> </span>List<span style="">
</span>listelt = rac.getChildren();</span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span><span style=""> </span><span style=""> </span></span><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);" lang="EN-GB">int</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"> ok=1;</span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span><span style=""> </span>Iterator i = listelt.iterator();</span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span><span style=""> </span></span><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);" lang="EN-GB">while</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB">(i.hasNext()&&
ok==1)</span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span><span style=""> </span>{</span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span><span style=""> </span><span style=""> </span><span style=""> </span><span style=""> </span>Element courrent = (Element)i.next();</span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span><span style=""> </span><span style=""> </span><span style=""> </span></span><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);" lang="EN-GB">if</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"> (courrent.getAttribute(</span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(42, 0, 255);" lang="EN-GB">"immatricule"</span><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB">).getValue().equals(</span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(42, 0, 255);" lang="EN-GB">"8345 tU 125"</span><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB">)){</span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span><span style=""> </span><span style=""> </span><span style=""> </span>System.</span><i><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 192);" lang="EN-GB">out</span></i><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB">.println(</span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(42, 0, 255);" lang="EN-GB">" "</span><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB">+courrent.getAttribute(</span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(42, 0, 255);" lang="EN-GB">"immatricule"</span><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB">).getValue());</span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span><span style=""> </span><span style=""> </span><span style=""> </span></span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(63, 127, 95);" lang="EN-GB">//Element
free = (Element)courrent.detach();</span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span><span style=""> </span><span style=""> </span><span style=""> </span>System.</span><i><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 192);" lang="EN-GB">out</span></i><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB">.println(rac.getName());</span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span><span style=""> </span><span style=""> </span><span style=""> </span></span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span><span style=""> </span><span style=""> </span><span style=""> </span></span><span style="font-size: 10pt; font-family: "Courier New"; color: black;">rac.<span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">removeContent</span>(courrent);</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"><span style=""> </span><span style=""> </span><span style=""> </span><span style=""> </span>ok=0;</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"><span style=""> </span><span style=""> </span><span style=""> </span><span style=""> </span></span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(63, 127, 95);">//courrent.removeChild(couleur);</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"><span style=""> </span><span style=""> </span><span style=""> </span><span style=""> </span>System.</span><i><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 192);">out</span></i><span style="font-size: 10pt; font-family: "Courier New"; color: black;">.println(</span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(42, 0, 255);">"supprimé"</span><span style="font-size: 10pt; font-family: "Courier New"; color: black;">);</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"><span style=""> </span><span style=""> </span><span style=""> </span><span style=""> </span>}</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"><span style=""> </span><span style=""> </span><span style=""> </span><span style=""> </span></span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New"; color: black;"><span style=""> </span></span><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"><span style=""> </span>}}</span><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);" lang="EN-GB">catch</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB">(Exception
e){</span><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);" lang="EN-GB">return</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;" lang="EN-GB"> e.getMessage();}</span><span style="font-size: 10pt; font-family: "Courier New";" lang="EN-GB"></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></p>
</div>