예제 #1
0
        public virtual ISiteMapNode BuildSiteMap(ISiteMap siteMap, ISiteMapNode rootNode)
        {
            var xml = xmlSource.GetXml();

            if (xml != null)
            {
                rootNode = LoadSiteMapFromXml(siteMap, xml);
            }

            // Done!
            return(rootNode);
        }
        public IList<string> GetAttributeValues(IXmlSource xmlSource, string attributeName)
        {
            var xml = xmlSource.GetXml();
            xmlNameProvider.FixXmlNamespaces(xml);

            var result = xml.Element(xmlNameProvider.RootName)
                            .Descendants()
                            .Select(e => (string)e.Attribute(attributeName))
                            .Where(x => x != null)
                            .Distinct()
                            .ToList();
            return result;
        }
예제 #3
0
        public IList <string> GetAttributeValues(IXmlSource xmlSource, string attributeName)
        {
            var xml = xmlSource.GetXml();

            xmlNameProvider.FixXmlNamespaces(xml);

            var result = xml.Element(xmlNameProvider.RootName)
                         .Descendants()
                         .Select(e => (string)e.Attribute(attributeName))
                         .Where(x => x != null)
                         .Distinct()
                         .ToList();

            return(result);
        }
        public IEnumerable <ISiteMapNodeToParentRelation> GetSiteMapNodes(ISiteMapNodeHelper helper)
        {
            var result = new List <ISiteMapNodeToParentRelation>();
            var xml    = xmlSource.GetXml();

            if (xml != null)
            {
                result.AddRange(LoadSiteMapNodesFromXml(xml, helper));
            }
            else
            {
                // Throw exception because XML was not defined
                throw new MvcSiteMapException(string.Format(Resources.Messages.XmlSiteMapNodeProviderXmlNotDefined, helper.SiteMapCacheKey));
            }

            return(result);
        }