This is not really a question. The answer would be: learn XML and implement all you want. You did not explain any particular concerns. You did not tell us anything about your language design, requirements, nothing like that.
Please see:
http://www.w3.org/TR/REC-xml[
^],
http://www.w3.org/TR/REC-xml/#sec-prolog-dtd[
^],
http://www.w3.org/TR/REC-xml/#sec-rmd[
^],
http://www.w3.org/XML/1998/06/xmlspec-report-v21.htm[
^].
But I have another idea. There is a newer way of describing the XML
metadata,
XML Schema:
http://en.wikipedia.org/wiki/XML_Schema_(W3C)[
^],
http://www.w3.org/standards/xml/schema[
^].
Frankly, DOCTYPE is ugly language with a lot of limitations. Its description in W3 standards is hard from perfect. It's hard or almost impossible to find a good DOCTYPE parser; and this is probably because its use is limited.
In contrast to that, XML schema is itself written in XML, so it can be parsed by many different tools; some of them are semantic-aware. There are enough of schema validation tools (validating XML against the schema). And the schema has much better expressive power, is much more flexible.
—SA