> Now to specify both DTDs in an XML file ('Transaction.XML'), I would do
> something like this
> <?xml version=3D"1.0"?>
> <!DOCTYPE enterpriseDataFormat SYSTEM
> <!DOCTYPE datasourceTransaction SYSTEM "Transaction.DTD">
No, you can't have two DocType Declarations. A document must belong
to one or the other: it cannot serve two masters...
If the root element type is declared in a DTD, then just change the
DocType Declaration so it refers to the root element type, but give the
name of the DTD where that is to be found, eg
<!DOCTYPE enterpriseDataFormat SYSTEM "Transaction.DTD">
A document that refers to a DTD does not have to start at the root
element implied by the DTD as a whole. This is the normal way to refer
to a fragment, eg this is a perfectly valid instance:
<!DOCTYPE P SYSTEM "html4.0.dtd">
<P>Here's a <em>real</em> fragment</P>
> Now in "XML: A Primer" there's no indication for the syntax to =
> reference one
> DTD from another so I assumed that the XML document type declaration =
> could be used in a DTD (fool that I am:-)). If I move the
> 'enterpriseDataFormat' document type declaration line from =
> to 'Transaction.DTD' then both XML4J and MSXML complain that DOCTYPE is =
> a valid DTD keyword. Simon?
XML uses SGML. All the basic rules of SGML apply, including entity
references. If you want to build and manage DTDs it might be worth
getting a good book about DTDs like Eve Maler and Jeanne el
Andaloussi's "SGML DTDs: from text to model to markup" (details in the
> Is there a way of working this without having to merge the DTD files?
Yes, you can write a DTD in modular fashion, so it includes code
from other files, using entity references.
> Should a parser accept more than one document type declaration?