Output of `-t xml` should have different `<!DOCTYPE ...>` declaration

The output of cmark -t xml currently has the document type declaration:

<!DOCTYPE CommonMark SYSTEM "CommonMark.dtd">

However, there is no CommonMark element in the DTD, and the declaration violates the XML 1.0 specification, which requires:

The Name in the document type declaration MUST match the element type of the root element.

Parsing the output XML with NSGMLS (nsgmls -wxml sample.xml) indeed gives this error:

nsgmls:sample.xml:2:44:E: DTD did not contain element declaration for document type name
nsgmls:sample.xml:3:9:E: document type does not allow element "document" here
nsgmls:sample.xml:28:12:E: no document element

The document type declaration should name the document’s root element, which is the element document in this case. With the second line of sample.xml changed to

<!DOCTYPE document SYSTEM "CommonMark.dtd">

the XML output of cmark -t xml is actually valid — at least NSGML does not complain any more.

Thanks! I’ve fixed this.