title: Write to XML file using Objective-C
body: <p>OK, I managed to read from an <code>XML</code> file using <code>NSXMLParser</code>, but now I don't know how to write to an <code>XML</code> file. I have an XML file, say:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;root&gt;
  &lt;user id="abcd" password="pass1"/&gt;
  &lt;user id="efg" password="pass2"/&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>Now when a new user enters details, I want to store them in a new tag. Lets say like, the <code>id</code> is "<strong>hhhh</strong>" and <code>password</code> is "<strong>pass3</strong>".</p>
  
  <p>I want to add a new tag with attributes as such:</p>
  
  <pre><code>&lt;user id="hhhh" password="pass3"/&gt;
  </code></pre>
  
  <p>to the XML file.</p>
  
  <p>How should I do this? Please explain in an elaborate way. I am a newbie here. Any links to tutorials or examples will be much helpful.</p>
  
  <p>Thanks.</p>