Creating sitemap.XML for Google Sitemap

aRn1s

New Member
When I use this code below in VB.NET\[code\]Dim xDoc = <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"></urlset>Dim node As XElement = <node><url> <loc><%= projectURL %>/<%= item.FolderName %>/map.htm</loc> <lastmod><%= Now.ToString("yyyy-MM-dd") %></lastmod> <changefreq>weekly</changefreq> <priority>0.5</priority> </url> <url> <loc><%= projectURL %>/<%= item.FolderName %>/index.htm</loc> <lastmod><%= Now.ToString("yyyy-MM-dd") %></lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url></node>xDoc.Add(node.Descendants("url"))xDoc.Save(IO.Path.Combine(directory, "sitemap.xml"))\[/code\]I get xml that looks like this one:\[code\]<?xml version="1.0" encoding="utf-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url xmlns=""> <loc>http://www.theupsstorelocal.com/0001/map.htm</loc> <lastmod>2012-04-25</lastmod> <changefreq>weekly</changefreq> <priority>0.5</priority> </url> </urlset>\[/code\]This is cool but I don't want \[code\]<url xmlns="">\[/code\] but just \[code\]<url>\[/code\]. I have no idea how to get rid of that empty attribute xmlns.
 
Back
Top