I am using the (.NET 3.5 SP1) System.Xml.Linq namespace to populate an html template document with div tags of data (and then save it to disk). Sometimes the div tags are empty and this seems to be a problem when it comes to HTML. According to my research, the DIV tag is not self-closing. Therefore, under Firefox at least, a <div />
is considered an opening div tag without a matching closing tag.
So, when I create new div elements by declaring:
XElement divTag = new XElement("div");
How can I force the generated XML to be <div></div>
instead of <div />
?