DTDs may be embedded in the XML files they prescribe rules for.
<?xml version="1.0"?>
<!DOCTYPE content [
<!ELEMENT content ANY>
]>
<content>Hello world!</content>
It is my strong belief, however that you are better off
writing them as external files connected to their XML docs
much the same way we use external css, or
js in XHTML docs.
In order to use a DTD write it:
and then use it
<?xml version="1.0"?>
<!DOCTYPE para SYSTEM "hello.dtd">
<para>Hello world!</para>
in case you wrote the DTD yourself, and you store it locally relative to the affected XML document. You may put it on the the net and address it by a URI:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE letter SYSTEM "http://deformation.org/blabla/dtds/letter.dtd">