title: How to modify xml file using PHP
body: <p>I want to modify my xml file in PHP based on the following criteria.</p>
  
  <p>my xml structure look like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt; 
  
  &lt;markers&gt;
     &lt;marker&gt;
        &lt;type&gt;&lt;/type&gt;
        &lt;title&gt;&lt;/title&gt;
        &lt;address&gt;&lt;/address&gt;
        &lt;latitude&gt;&lt;/latitude&gt;
        &lt;longitude&gt;&lt;/longitude&gt;
     &lt;marker&gt;
     &lt;marker&gt;
        &lt;type&gt;&lt;/type&gt;
        &lt;title&gt;&lt;/title&gt;
        &lt;address&gt;&lt;/address&gt;
        &lt;latitude&gt;&lt;/latitude&gt;
        &lt;longitude&gt;&lt;/longitude&gt;
     &lt;marker&gt;
  &lt;/markers&gt;
  </code></pre>
  
  <p>Now every time when xml going to modify, with the type attribute.</p>
  
  <p>means, on first time search string == "hotels" then data related to hotels will be stored in xml file as above format.</p>
  
  <p>Now when again search for hotels is done then it will remove the elements which have child element with value hotels. </p>
  
  <p>and search for different query for e.g. schools is done at that time data related to the schools are appended to the xml file. with the data of the hotels.</p>
  
  <p>now again search for schools is done then it will remove the element related to schools.</p>
  
  <p>Thanks in advance.</p>