Esempio n. 1
0
        //对“包含文件”(stl:include)元素进行解析
        public static string Parse(string stlElement, XmlNode node, PageInfo pageInfo, ContextInfo contextInfo)
        {
            var parsedContent = string.Empty;

            try
            {
                var ie        = node.Attributes.GetEnumerator();
                var file      = string.Empty;
                var isContext = !pageInfo.PublishmentSystemInfo.Additional.IsCreateIncludeToSsi;
                var isDynamic = false;

                while (ie.MoveNext())
                {
                    var attr          = (XmlAttribute)ie.Current;
                    var attributeName = attr.Name.ToLower();
                    if (attributeName.Equals(Attribute_File))
                    {
                        file = StlEntityParser.ReplaceStlEntitiesForAttributeValue(attr.Value, pageInfo, contextInfo);
                        file = PageUtility.AddVirtualToUrl(file);
                    }
                    else if (attributeName.Equals(Attribute_IsContext))
                    {
                        isContext = TranslateUtils.ToBool(attr.Value);
                    }
                    else if (attributeName.Equals(Attribute_IsDynamic))
                    {
                        isDynamic = TranslateUtils.ToBool(attr.Value);
                    }
                }

                if (isDynamic)
                {
                    parsedContent = StlDynamic.ParseDynamicElement(stlElement, pageInfo, contextInfo);
                }
                else
                {
                    parsedContent = ParseImpl(pageInfo, contextInfo, file, isContext);
                }
            }
            catch (Exception ex)
            {
                parsedContent = StlParserUtility.GetStlErrorMessage(ElementName, ex);
            }

            return(parsedContent);
        }
Esempio n. 2
0
        public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
        {
            var file = string.Empty;

            foreach (var name in contextInfo.Attributes.Keys)
            {
                var value = contextInfo.Attributes[name];

                if (StringUtils.EqualsIgnoreCase(name, AttributeFile))
                {
                    file = StlEntityParser.ReplaceStlEntitiesForAttributeValue(value, pageInfo, contextInfo);
                    file = PageUtility.AddVirtualToUrl(file);
                }
            }

            return(ParseImpl(pageInfo, contextInfo, file));
        }
Esempio n. 3
0
        public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
        {
            var file       = string.Empty;
            var parameters = new Dictionary <string, string>();

            foreach (var name in contextInfo.Attributes.AllKeys)
            {
                var value = contextInfo.Attributes[name];

                if (StringUtils.EqualsIgnoreCase(name, File.Name))
                {
                    file = StlEntityParser.ReplaceStlEntitiesForAttributeValue(value, pageInfo, contextInfo);
                    file = PageUtility.AddVirtualToUrl(file);
                }
                else
                {
                    parameters[name] = StlEntityParser.ReplaceStlEntitiesForAttributeValue(value, pageInfo, contextInfo);
                }
            }

            return(ParseImpl(pageInfo, contextInfo, file, parameters));
        }