One small problem with doing this, when you read the innerXML property, by default an xmldom will collapse empty nodes to short tag syntax:
If you run the following block of code against your dom, the tags will render as full tags, and create valid html markup.
for each element as XmlElement in HtmlContent.SelectNodes("//*[not(node())]")
element.isEmpty = false
next