Turns out this is simple option in the XmlTextReader (and XmlValidatingReader) class - "EntityHandling".
So a simple demo of your problem:
System.Xml.XmlTextReader textReader = new System.Xml.XmlTextReader("testin.xml");
textReader.EntityHandling = System.Xml.EntityHandling.ExpandEntities;
System.Xml.XmlDocument outputDoc = new System.Xml.XmlDocument();
outputDoc.Load(textReader);
System.Xml.XmlDocumentType docTypeIfPresent = outputDoc.DocumentType;
if (docTypeIfPresent != null)
outputDoc.RemoveChild(docTypeIfPresent);
outputDoc.Save("testout.html");
textReader.Close();
And if you prefer not to have to load the document into memory, a streaming equivalent:
System.Xml.XmlTextReader textReader = new System.Xml.XmlTextReader("testin.xml");
textReader.EntityHandling = System.Xml.EntityHandling.ExpandEntities;
System.Xml.XmlTextWriter textWriter = new System.Xml.XmlTextWriter("testout.html", System.Text.Encoding.UTF8);
while (textReader.Read())
{
if (textReader.NodeType != System.Xml.XmlNodeType.DocumentType)
textWriter.WriteNode(textReader, false);
else
textReader.Skip();
}
textWriter.Close();