using System.Collections.Generic; using System.Linq; using System.Web; using System.Xml; using System.Xml.Linq; namespace CD67.ModeleMVC.MVC.Internal { public static class Navigation { public static string SMap(SiteMapNode node) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); List nodes = new List(); nodes.Add(node); if (SiteMap.CurrentNode.ParentNode != null) { SMap(SiteMap.CurrentNode.ParentNode); } nodes.Reverse(); sb.Append(""); return sb.ToString(); } public static string Xmap(string title) { string toto = ""; XDocument xmap = XDocument.Load("~/web.sitemap"); var current = xmap.Ancestors("SiteMapNode") .Where(x => (string)x.Attribute("title") == title); current.Reverse(); foreach(var currence in current) { toto += currence.Attribute("title").Value; } return toto; } public static string XmlMap(string title) { string toto = ""; XmlDocument xml = new XmlDocument(); xml.Load(HttpContext.Current.Server.MapPath("/web.sitemap")); XmlNodeList nodes = xml.DocumentElement.SelectNodes("//*[@title='" + title + "']/ancestor-or-self::SiteMapNode"); foreach(XmlNode node in nodes) { toto += node.Attributes["title"].Value; } return toto; } } }