Пример #1
0
        public List <HtmlChunk> ParseToChunks(string html)
        {
            //List<HtmlChunk> controls = new List<HtmlChunk>();
            //Read header tag, if any.
            HtmlDoc htmDoc = new HtmlDoc(html);

            //Get the plugin for this doctype
            IHtmlParserPlugin parser = _plugins[htmDoc.DocumentType];

            //Get Chunks
            return(parser.CreateChunks(htmDoc));
        }
Пример #2
0
        public System.Web.UI.Control[] ParseToControls(System.Web.UI.Page page, string html)
        {
            List <System.Web.UI.Control> controls = new List <System.Web.UI.Control>();
            //Read header tag, if any.
            HtmlDoc htmDoc = new HtmlDoc(html);

            //Get the plugin for this doctype
            IHtmlParserPlugin parser = _plugins[htmDoc.DocumentType];

            //Get Chunks
            return(parser.CreateControls(page, htmDoc));
        }
Пример #3
0
        public List <HtmlChunk> ParseToChunks(EntityCollection <TemplateChunksEntity> chunks, string parserType)
        {
            if (!_plugins.ContainsKey(parserType))
            {
                throw new BASEGenericException("Parser type does not exist");
            }

            //Get the plugin for this doctype
            IHtmlParserPlugin parser = _plugins[parserType];

            //Get Chunks
            return(parser.CreateChunks(chunks));
        }
Пример #4
0
        public System.Web.UI.Control[] ParseToControls(System.Web.UI.Page page, List <HtmlChunk> chunks, string parserType)
        {
            if (!_plugins.ContainsKey(parserType))
            {
                throw new BASEGenericException("Parser type does not exist");
            }

            //Get the plugin for this doctype
            IHtmlParserPlugin parser = _plugins[parserType];

            //Get Chunks
            return(parser.CreateControls(page, chunks));
        }
        /// <summary>
        /// This method parses the 'HtmlParserPlugins' section of the BASE.config file.
        /// You can add/remove/modify plugins to change and/or expand BASE's HtmlParsing system
        /// </summary>
        /// <param name="xmlnode"></param>
        internal void ParseHtmlParserPlugins(XmlNode xmlnode)
        {
            foreach (XmlNode ch in xmlnode.ChildNodes)
            {
                if (ch.Name != "htmlParserPlugin")
                {
                    continue;
                }

                string tag  = ch.Attributes["tag"].Value;
                string type = ch.Attributes["type"].Value;

                object plugin = TypeHelper.CreateTypeFromConfigString(type);
                if (plugin is IHtmlParserPlugin)
                {
                    IHtmlParserPlugin iplug = (IHtmlParserPlugin)plugin;
                    iplug.Init(ch);
                    HtmlParser.AddPlugin(iplug);
                }
            }
        }
Пример #6
0
 public static void AddPlugin(IHtmlParserPlugin plugin)
 {
     _plugins.Add(plugin.HtmlParserTag, plugin);
 }