Using SGML Reader to close single HTML tags

156 Views Asked by At

I am using SgmlReader to generate XHTML output from HTML. The question is regarding single HTML tags like

<IMG>

When using SgmlReader, this tag is generated as

<IMG></IMG>

I know that this is syntactically correct, however, for XHTML style, I need to know if it is possible to generate

<IMG />

instead.

Regards Jaime

1

There are 1 best solutions below

0
On

You just need to specify DocType property, like this one:

Sgml.SgmlReader sgmlReader = new Sgml.SgmlReader();
sgmlReader.DocType = "HTML";

Also you should have "Html.dtd" file in embedded resources of SgmlReader project. It helped me.