The Pro Version of FreeTextBox has a neat feature that will clean up poorly written HTML to a cleaner XHTML.
FreeTextBoxControls.FreeTextBox ftb = new FreeTextBoxControls.FreeTextBox(); string html = "<P><img src=joe.gif width=200 height=100 vspace=10>"; ftb.Text = html; string xhtml = ftb.Xhtml; Trace.Write("HTML", html); Trace.Write("XHTML", xhtml);
Before and After
<P><img src=joe.gif width=200 height=100 vspace=10>
<p> <img src="joe.gif" width="200" height="100" vspace="10" /> </p>
The FreeTextBox closed the paragraph tag, made the paragraph tag lower-case, added quotes to all the attributes and closed the img tag to make the entire string XML compliant. What this control didn’t do was replace the deprecated vspace attribute with it’s CSS equivalent.
