|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Parsing HTML in ControlsI have a task to translate HTML text from a database to a legacy proprietary format none html. For this I was hoping to load the HTML into object model where each HTML table or div or span tag is an object from which I can read the attributes and generate the proprietary output. I tried using System.Web.UI.HTMLGenericControl for example: Dim sHTML As New Web.UI.HtmlControls.HtmlGenericControl sHTML.innerHTML= "some text<div>a div tag</div><table><tr><td>C1</td></tr></table>" Hoping that I can then access an HTMLTable control as a child control of sHTML and the same for div/span tags. Is there a way to do this? I used to be able to do the similar task with java script on the client side. But I need to do that now without loading this html into a browser, I need to do it on the server. Thank you, Nick Hello Nick,
You probably should think of solving the problem in a different way. For example, what are the pieces of information that you are looking to get out of the HTML markup and then you might be able to use regular expressions to convert the HTML objects to XML datatable. In this example I did something similar but with an XML input file: http://www.webswapp.com/codesamples/aspnet20/regular_expressions/vb.aspx Show quoteHide quote "Nick" wrote: > Hello, > > I have a task to translate HTML text from a database to a legacy proprietary > format none html. For this I was hoping to load the HTML into object model > where each HTML table or div or span tag is an object from which I can read > the attributes and generate the proprietary output. > I tried using System.Web.UI.HTMLGenericControl for example: > > Dim sHTML As New Web.UI.HtmlControls.HtmlGenericControl > sHTML.innerHTML= "some text<div>a div > tag</div><table><tr><td>C1</td></tr></table>" > > Hoping that I can then access an HTMLTable control as a child control of > sHTML and the same for div/span tags. Is there a way to do this? > I used to be able to do the similar task with java script on the client > side. But I need to do that now without loading this html into a browser, I > need to do it on the server. > > Thank you, > Nick
ASP.NET 2.0 and ObjectDataBinding
C#/ASP.NET 2.0 - Convert HTML Table to DataGrid/Source How to set property "ReadOnly" on all TextBoxes on a WebForm Dynamic Textboxes. Composite Server Control and DefaultValue Attribute Type.GetType() Row count for query through SqlDataSource and GridView Datagrid viewstate TreeView web control not displaying how to create graphs in ASP? |
|||||||||||||||||||||||