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)); }
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)); }
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)); }
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); } } }
public static void AddPlugin(IHtmlParserPlugin plugin) { _plugins.Add(plugin.HtmlParserTag, plugin); }