Remove the Parent tag in xml using php

Posted by Wasim on Stack Overflow See other posts from Stack Overflow or by Wasim
Published on 2010-05-12T11:09:58Z Indexed on 2010/05/12 11:14 UTC
Read the original article Hit count: 274

Filed under:
|

I am facing a problem in editing a xml file.

<?xml version="1.0" encoding="UTF-8"?>

  <urlset>

  <url>
   <loc>http://www.abc.com/</loc>
   <lastmod>2010-04-17T17:23:57+00:00</lastmod>
   <changefreq>daily</changefreq>
   <priority>0.50</priority>
  </url>
  <url>
   <loc>http://www.abc.com/</loc>
   <lastmod>2010-04-17T17:23:57+00:00</lastmod>
   <changefreq>daily</changefreq>
   <priority>0.50</priority>
  </url>

</urlset>

I want to add one more set of records starting with <url> with its other tags, (i.e) "loc,lastmod,changefreq,priority" and than save the xml file.For adding the new record i need to remove the parent closing tag that is </urlset> and than add the rest of the records and close the main tag.
Can anyone please help me solving my problem.Thanks

© Stack Overflow or respective owner

Related posts about Xml

Related posts about php