System.Web.XmlSiteMapProvider.GetRootNodeCore C# (CSharp) Method

GetRootNodeCore() protected method

protected GetRootNodeCore ( ) : SiteMapNode
return SiteMapNode
		protected internal override SiteMapNode GetRootNodeCore ()
		{
			return BuildSiteMap ();
		}
	}

Usage Example

示例#1
0
        void BuildSiteMapRecursive(XmlNode xmlNode, SiteMapNode parent)
        {
            if (xmlNode.Name != "siteMapNode")
            {
                throw new ConfigurationException("incorrect element name", xmlNode);
            }

            string attrValue = GetNonEmptyOptionalAttribute(xmlNode, "provider");

            if (attrValue != null)
            {
                SiteMapProvider provider = SiteMap.Providers [attrValue];
                if (provider == null)
                {
                    throw new ProviderException("Provider with name [" + attrValue + "] was not found.");
                }

                provider.ParentProvider = this;
                SiteMapNode providerRoot = provider.GetRootNodeCore();

                if (parent == null)
                {
                    root = providerRoot;
                }
                else
                {
                    AddNodeNoCheck(providerRoot, parent);
                }
                return;
            }

            attrValue = GetNonEmptyOptionalAttribute(xmlNode, "siteMapFile");
            if (attrValue != null)
            {
                var nvc = new NameValueCollection();
                nvc.Add("siteMapFile", attrValue);

                string description = GetOptionalAttribute(xmlNode, "description");
                if (!String.IsNullOrEmpty(description))
                {
                    nvc.Add("description", description);
                }

                string name     = MapUrl(attrValue);
                var    provider = new XmlSiteMapProvider();
                provider.Initialize(name, nvc);

                SiteMapNode providerRoot = provider.GetRootNodeCore();
                if (parent == null)
                {
                    root = providerRoot;
                }
                else
                {
                    AddNodeNoCheck(providerRoot, parent);
                }
                return;
            }

            SiteMapNode curNode = ConvertToSiteMapNode(xmlNode);

            if (parent == null)
            {
                root = curNode;
            }
            else
            {
                AddNodeNoCheck(curNode, parent);
            }

            XmlNodeList childNodes = xmlNode.ChildNodes;

            if (childNodes == null || childNodes.Count < 1)
            {
                return;
            }

            foreach (XmlNode child in childNodes)
            {
                if (child.NodeType != XmlNodeType.Element)
                {
                    continue;
                }

                BuildSiteMapRecursive(child, curNode);
            }
        }
All Usage Examples Of System.Web.XmlSiteMapProvider::GetRootNodeCore