title: How to create this XML with Delphi?
body: <p>I want to write some code (in Delphi) to get this XML scheme, I tried but no result as I want, could you help me !
  I use (or want use) IXMLDocument created at runtime, but I can't understand "Nodes", "ChildNodes" ... I know, it's ridiculous !</p>
  
  <p>This is the scheme example I want :</p>
  
  <pre><code>&lt;Items&gt;
   &lt;Task id="eec0-47de-91bc-98e2d69d75cd"&gt;
     &lt;Title&gt;The title of something&lt;/Title&gt;
     &lt;State&gt;Done&lt;/State&gt;
     &lt;IdNoHashed&gt;This Is a string&lt;/IdNoHashed&gt;
     &lt;CreatedDate&gt;28/12/2011 06:24:57&lt;/CreatedDate&gt;
     &lt;Note&gt;Just a note&lt;/Note&gt;
   &lt;/Task&gt;
   &lt;Task id="e2x5d4-2d45c-98e2d69d75cd"&gt;
     &lt;Title&gt;Another title&lt;/Title&gt;
     &lt;State&gt;Done&lt;/State&gt;
     &lt;IdNoHashed&gt;This Is a string 2&lt;/IdNoHashed&gt;
     &lt;CreatedDate&gt;28/12/2011 22:22:22&lt;/CreatedDate&gt;
     &lt;Note&gt;Just a note, again !&lt;/Note&gt;
   &lt;/Task&gt;
  &lt;/items&gt;
  </code></pre>
  
  <p>Do you have a suggestion ?
  Thank you !</p>
  
  <p>EDIT : I Tried the code answered below, It works fine, but when I want to add any other entry in the Root, it rewrites the already-exist element.</p>
  
  <pre><code>Function WriteData (id, title, state, idNH : String) : Boolean;
   var
     Doc: IXMLDocument;
     Items, Task: IXMLNode;
  begin
    Doc := NewXMLDocument;
    Items := Doc.AddChild('Items');
  
    Task := Items.AddChild('Task');
    Task.Attributes['id'] := id;
    Task.AddChild('Title').Text := title;
    Task.AddChild('State').Text := state;
    Task.AddChild('IdNoHashed').Text := idNH;
    Task.AddChild('CreatedDate').Text := DateTimeToStr(Now);
    Task.AddChild('Note').Text := 'Just a note';
  end;
  </code></pre>
  
  <p>I tried DocumentElement.ChildNodes.FindNode(id), but not success !</p>
  
  <p>I created a function which I call each time to add/modify an entry in the XML file, the entry is "".
  An idea to how can I do this ?!
  Thank you !</p>