In the xml-dev mailing list, some people requested a media type for DTD (to
be precise, an external DTD subset), since browsers should be able to launch
a DTD viewer for DTDs. One could also argue that an additional parameter of
text/xml and application/xml is enough for that purpose.
Other than external DTD subsets and XML documents, there are two types of
XML network entities. They are external parsed entities and external parameter
entities.
At present, RFC 2376 says that text/xml and application/xml can be
used for all of the four types. No mechanisms for distinguishing the
four types are present.
Can we use XML processors to distinguish these four types? The answer is No.
A DTD does not parse as an XML document.
An external parsed entity does not typically parse as an XML document.
(Note: it is possible to create an external parsed entity which also
parses as an XML document.)
An external parameter entity does not parse as an XML document.
(Note: an external parameter entity can also become an external DTD subset.)
Then, can we develop some other program to distinguish the four types?
It is possible, but not likely.
To do such autodetection, programs have to understand the charset parameter,
handle the specified charset, and then compare the text against the BNFs for
the four types. People will not implement such complicated autodetection, in
my humble opinion.
Cheers,
Makoto
Fuji Xerox Information Systems
Tel: +81-44-812-7230 Fax: +81-44-812-7231
E-mail: murata(_at_)apsdc(_dot_)ksp(_dot_)fujixerox(_dot_)co(_dot_)jp