Repairing malformatted html attributes using c#

Posted by jhoefnagels on Stack Overflow See other posts from Stack Overflow or by jhoefnagels
Published on 2011-11-24T09:46:00Z Indexed on 2011/11/24 9:51 UTC
Read the original article Hit count: 530

Filed under:
|
|
|

I have a web application with an upload functionality for HTML files generated by chess software to be able to include a javascript player that reproduces a chess game.

I do not like to load the uploaded files in a frame so I reconstruct the HTML and javascript generated by the software by parsing the dynamic parts of the file.

The problem with the HTML is that all attributes values are surrounded with an apostrophe instead of a quotation mark. I am looking for a way to fix this using a library or a regex replace using c#.

The html looks like this:

<DIV class='pgb'><TABLE class='pgbb' CELLSPACING='0' CELLPADDING='0'><TR><TD>

and I would transform it into:

<DIV class="pgb"><TABLE class="pgbb" CELLSPACING="0" CELLPADDING="0"><TR><TD>

© Stack Overflow or respective owner

Related posts about c#

Related posts about html