I have a xml file as below
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://ezinearticles.com/</loc>
<changefreq>hourly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://ezinearticles.com/submit/</loc>
<changefreq>weekly</changefreq>
<priority>0.3</priority>
</url>
...................
I want to use xpathin lxml module to get URL from all tag. I implemented it as below code but it didn't work. The result is empty list
from lxml import etree
parser = etree.XMLParser(ns_clean=True)
xmlfile = "sitemap1.xml"
xmlobj = etree.parse(xmlfile, parser)
loc = xmlobj.xpath('//loc[text()]')
print(loc)
Can anyone help me fix my script ?