Extract Links from a sitemap(xml)
- by Akshat Mittal
Lets say I have a sitemap.xml file with this data:
<url>
<loc>http://domain.com/pag1</loc>
<lastmod>2012-08-25</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>http://domain.com/pag2</loc>
<lastmod>2012-08-25</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>http://domain.com/pag3</loc>
<lastmod>2012-08-25</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
I want to extract all the locations from it (data between <loc> and </loc>).
Sample output be like:
http://domain.com/pag1
http://domain.com/pag2
http://domain.com/pag3
How to do this?