My xml is:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>http://localhost:2511/SF/sitemap_1.xml</loc>
<lastmod>2013-11-11T04:17:57+00:00</lastmod>
</sitemap>
<sitemap>
<loc>http://localhost:2511/SF/sitemap_2.xml</loc>
<lastmod>2013-11-11T04:17:57+00:00</lastmod>
</sitemap>
</urlset>
And I try to change each <lastmod>
value like this :
XmlDocument doc = new XmlDocument();
doc.Load(HttpRuntime.AppDomainAppPath + "sitemap_index.xml"); //Doc is loaded successfully
//XmlNodeList nodeList = doc.SelectNodes("/urlset/sitemap/lastmod");//I also try this one
XmlNodeList nodeList = doc.DocumentElement.SelectNodes("/urlset/sitemap/lastmod");
foreach (XmlNode xmlNode in nodeList)
{
xmlNode.InnerText = DateTime.Now.ToString();
}
But I always get nodeList
count 0. What is my mistake.Thanks for help.