protected void Page_Load(object sender, EventArgs e) { XmlWriterSettings writerSettings = new XmlWriterSettings(); writerSettings.Encoding = new UTF8Encoding(false); writerSettings.Indent = true; XmlWriter writer = XmlWriter.Create(Server.MapPath("videoSiteMap.xml"), writerSettings); writer.WriteStartDocument(); writer.WriteStartElement("urlset", "http://www.sitemaps.org/schemas/sitemap/0.9"); writer.WriteAttributeString("xmlns", "video", null, "http://www.google.com/schemas/sitemap-video/1.0"); string pubId = "745456160001"; string playId = "745456405001"; videoArchive archive = (videoArchive)Cache["Archive"]; if (archive == null) { buildVideoArchive builder = new buildVideoArchive(); archive = builder.render(false); } if (archive != null) { foreach (videoCategory category in archive.categories) { foreach (videoItem item in category.videos) { if (category.name == "Kommunfullmäktige") { pubId = "2494809924001"; playId = "2821564386001"; } writeTag(category.name, pubId, playId, item, writer); } } } writer.WriteEndDocument(); writer.Close(); Response.Redirect("videoSiteMap.xml"); }
protected void Page_Load(object sender, EventArgs e) { XmlWriterSettings writerSettings = new XmlWriterSettings(); writerSettings.Encoding = new UTF8Encoding(false); writerSettings.Indent = true; XmlWriter writer = XmlWriter.Create(Server.MapPath("siteMap.xml"), writerSettings); writer.WriteStartDocument(); writer.WriteStartElement("urlset", "http://www.sitemaps.org/schemas/sitemap/0.9"); videoArchive archive = (videoArchive)Cache["Archive"]; if (archive == null) { buildVideoArchive builder = new buildVideoArchive(); archive = builder.render(false); } if (archive != null) { foreach (videoCategory category in archive.categories) { string priority = "0.5"; if (category.name == "Aktuellt") { priority = "1.0"; } foreach (videoItem item in category.videos) { writeTag(item, writer, priority); } } } writer.WriteEndDocument(); writer.Close(); Response.Redirect("siteMap.xml"); }