HtmlTextWriter or XmlTextWriter?

  • Thread starter Thread starter Gustaf Liljegren
  • Start date Start date
G

Gustaf Liljegren

I need to export an HTML file, conforming to HTML 4.01 Strict in UTF-8.
I have written code for this in XmlTextWriter. Unfortunately, there seem
to be no way to remove the XML declaration. The WriteStartDocument()
method must be called before writing the root element.

So I had a look at HtmlTextWriter instead, but I can't find a way to
save a document from there, no way to add a DOCTYPE declaration, and no
way to set the encoding.

Can it be done in .NET?

Gustaf
 
HtmlTextWriter is (somewhat) non-validating, I use it only to inject code
snippets into regions of a page. It renders html directly to the output
stream. You can use the Write and WriteLine methods to write any string you
want, but it needs to override a control's render method.

Any chance you can use XHTML 1.0 instead?
http://weblogs.asp.net/jezell/archive/2003/10/24/33376.aspx

ok,
aq
 
Back
Top