Referencing multiple DTD in an XML document

David Brownell david-b at
Tue Nov 2 19:09:45 GMT 1999

mparul at wrote:
> Is it possible to reference two DTD files in the DOCTYPE declaration in an
> XML document?

Absolutely -- just use the right syntax.

First, keep in mind that there are only "external parameter entities".
Too many people talk as if the external subset, as in


is the DTD ... instead, the whole <!DOCTYPE ...> is the DTD, which
is just a set of declarations.  Don't think of a "DTD file", since
DTDs can consist of many files.

Second, keep in mind that the external subset is only syntactic
sugar, and you can do the same thing without an external subset:

	<!DOCTYPE foo [
	<!ENTITY % foo SYSTEM "">

That DTD is semantically equivalent to the first one I showed.

> If not, then how can one use both MathML and say SpeechML tags in an XML
> document.

I presume you want the answer even if you _can reference more than
one external parameter entity?  :-)

It's a simple extension of what I showed above:

	<!DOCTYPE foo [
	<!ENTITY % SpeechML SYSTEM "">

I'd encourage you to use PUBLIC identifiers as well, so that
local cached copies of those declarations can easily be used.

As has been pointed out, actually combining two DTDs can be a
problem if they happen to use the same element or entity names
for different purposes.  DTD syntax was designed to allow you
to combine sets of declarations designed for that purpose, but
if they weren't so designed ... trouble.  Namespace-aware schemas
may provide solutions in that space, at some point.

- Dave

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list