Generating XML and HTML fragments to be stringly-embedded inside of XML and HTML text seems like a fairly valid use case for this library. But there should only be one DOCTYPE or XML PI per document.
Generating a DOCTYPE or XML PI only when encountering a *TOP* node in the SXML (indicating the root node of a document tree so we know it’s not a fragment) seems like a reasonable way to do this?
According to the HTML DOM, DOCTYPEs are actually a special kind of node. I’ve treated them as such in my implementation (*doctype*, see #4); *top* currently only serializes its children.
Generating XML and HTML fragments to be stringly-embedded inside of XML and HTML text seems like a fairly valid use case for this library. But there should only be one DOCTYPE or XML PI per document.
Generating a DOCTYPE or XML PI only when encountering a
*TOP*
node in the SXML (indicating the root node of a document tree so we know it’s not a fragment) seems like a reasonable way to do this?