我的xml是:
<?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>
我尝试<lastmod>
像这样更改每个值:
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();
}
但我总是得到nodeList
计数 0。我的错误是什么。谢谢你的帮助。