protected SiteMapBase() { CacheDurationInMinutes = DefaultCacheDurationInMinutes; Compress = DefaultCompress; GenerateSearchEngineMap = DefaultGenerateSearchEngineMap; RootNode = new SiteMapNode(); }
public SiteMapNodeBuilder Add() { var node = new SiteMapNode(); parent.ChildNodes.Add(node); return new SiteMapNodeBuilder(node); }
public virtual void Reset() { CacheDurationInMinutes = DefaultCacheDurationInMinutes; Compress = DefaultCompress; GenerateSearchEngineMap = DefaultGenerateSearchEngineMap; RootNode = new SiteMapNode(); }
public SiteMapNodeFactory(SiteMapNode parent) { Check.Argument.IsNotNull(parent, "parent"); this.parent = parent; }
private static void PopulateNode(SiteMapNode siteMapNode, XmlNode xmlNode) { var routeValues = new RouteValueDictionary(); XmlNode xmlRouteValuesNode = xmlNode.FirstChild; if ((xmlRouteValuesNode != null) && xmlRouteValuesNode.LocalName.IsCaseSensitiveEqual(RouteValuesNodeName)) { foreach (XmlNode routeValue in xmlRouteValuesNode.ChildNodes) { routeValues[routeValue.LocalName] = routeValue.InnerText; } } siteMapNode.Title = GetStringValueFromAttribute(xmlNode, TitleAttributeName); siteMapNode.Visible = GetBooleanValueFromAttribute(xmlNode, VisibleAttributeName, true); string routeName = GetStringValueFromAttribute(xmlNode, RouteAttributeName); string controllerName = GetStringValueFromAttribute(xmlNode, ControllerAttributeName); string actionName = GetStringValueFromAttribute(xmlNode, ActionAttributeName); string url = GetStringValueFromAttribute(xmlNode, UrlAttributeName); string areaName = GetStringValueFromAttribute(xmlNode, AreaAttributeName); if (areaName != null) { routeValues["area"] = areaName; } if (!string.IsNullOrEmpty(routeName)) { siteMapNode.RouteName = routeName; siteMapNode.RouteValues.Clear(); siteMapNode.RouteValues.Merge(routeValues); } else if (!string.IsNullOrEmpty(controllerName) && !string.IsNullOrEmpty(actionName)) { siteMapNode.ControllerName = controllerName; siteMapNode.ActionName = actionName; siteMapNode.RouteValues.Clear(); siteMapNode.RouteValues.Merge(routeValues); } else if (!string.IsNullOrEmpty(url)) { siteMapNode.Url = url; } DateTime? lastModified = GetDateValueFromAttribute(xmlNode, LastModifiedAttributeName); if (lastModified.HasValue) { siteMapNode.LastModifiedAt = lastModified.Value; } siteMapNode.IncludeInSearchEngineIndex = GetBooleanValueFromAttribute(xmlNode, IncludeInSearchEngineIndexAttributeName, true); if (xmlNode.Attributes != null) foreach (XmlAttribute attribute in xmlNode.Attributes) { if (!string.IsNullOrEmpty(attribute.LocalName)) { // Only add unknown attibutes if (Array.BinarySearch(knownAttributes, attribute.LocalName, StringComparer.OrdinalIgnoreCase) < 0) { siteMapNode.Attributes.Add(attribute.LocalName, attribute.Value); } } } }
private static void Iterate(SiteMapNode siteMapNode, XmlNode xmlNode) { PopulateNode(siteMapNode, xmlNode); foreach (XmlNode xmlChildNode in xmlNode.ChildNodes) { if (xmlChildNode.LocalName.IsCaseSensitiveEqual(SiteMapNodeName)) { var siteMapChildNode = new SiteMapNode(); siteMapNode.ChildNodes.Add(siteMapChildNode); Iterate(siteMapChildNode, xmlChildNode); } } }