Trickier when there's no DOCTYPE at all.
Need to add a DOCTYPE directly into the stream the parser reads.
In Java, do this with SequenceInputStream and mark and reset
SequenceInputStream