How can I programmatically validate html ?



I am importing text from a column of a database table to display as
part of a web page in asp.net. There are about 7000 rows in the table.

About 10% of the columns have their content as html and about 10% of
those columns have badly broken html. When broke it generally uses <tr>
and <td> content with no enclosing <table>.

I have two alternatives.

1. I could write a program to create a page from each occurence of html
content in a row and validate that against a html parser.

As anyone done this. If so how could it be done. which parser could be
used?

2. I can replace all the table tags in the database:

<tr -> <div
</tr> -> </div>
<table -> <div
</table> -> </div>
<td -> <span
</td> -> </span>

That will also give me broken html but not nearly as bad because
afterwards at least everything will display in the correct order that
the document author intended. That's what doesn't always happen now;
generally when there is <tr> and <td> content with no enclosing <table>.


.



Relevant Pages

  • Re: search component using picture alternative text
    ... Its doesn't take luck. ... Here's a tidbit...put HTML comments into the fields of your database ... preventing their display. ...
    (microsoft.public.frontpage.programming)
  • Re: Poll: Is a calendar tabular?
    ... Don't confuse display with the underlying data. ... The pont I was making was that, in document markup in HTML you would ... use a table to contain calendar 'data' and in a database you would use ... But you wouldn't create a database ...
    (comp.infosystems.www.authoring.html)
  • Re: What if you dont have a thead/tbody/tfoot?
    ... use their HTML parser to do it, treating the contents of your page as HTML ... depends on IE's error correction to display properly in the first place. ... IE uses its HTML parser to display it. ... So even if your XHTML page validates, you're still relying on IE's HTML ...
    (alt.html)
  • Re: Using DataSource object with JNDI
    ... Use the HTML table to organize the display. ... Then return the collection object to the servlet, ... connected to a database via jdbc. ...
    (comp.lang.java.programmer)
  • How do I convert access 2003 to HTML and get lines around blank f.
    ... I'm currently using Office 97 and received Office 2003 for Christmas. ... converted one of the 97 database to 2003, then converted the 2003 database to ... When I display the HTML file with Internet Explorer, ...
    (microsoft.public.access.setupconfig)