Creating
a DTD from the scratch is a tedious task if you do not know the syntax
of the DTD document properly. For this you also have to learn some of
the keywords and the way they are used in creating the DTD.
_______________________________________________
_______________________________________________
One
of the best ways is to create the DTD from the XML document through
some tool. There are tools that would do the task of creating the DTD
for you, if you input the XML document to that tool.
If you
are using some IDE for editing XML documents then that IDE should have
such a feature in-built. XML editors like XMLSpy, Xselerator, Cooktop,
and StylusStudio have such tools in them. All you have to do is to open
the XML document for which you want to generate the DTD and then use
the tool to generate DTD.
While doing
so you might be prompted to choose whether you need the DTD to be embedded
within the XML document itself or it should be separately in an external
file. If you choose the second option a link to the DTD will be given
in the XML file automatically.