The purpose of a DTD is to define the legal building blocks of an XML document.It defines the document structure with a list of legal elements.What i misunderstood is that, there's no way with the DOM api to specify a "default namespace" for each children of the root element.Thus you may need to use create Element NS() and create Attribute NS() methods for each created element or attribute in the document specifying the URI of your namespace each time ("
DTD is the older of the two, and as such, it has limitations that XML Schema has tried to improve.
The first difference between DTD and XML Schema, is namespace awareness; XML Schema is, while DTD is not.
Namespace awareness removes the ambiguity that can result in having certain elements and attributes from multiple XML vocabularies, by giving them namespaces that put the element or attribute into context.
When authoring document is HTML or XHTML, it is important to Add a Doctype declaration.
This makes sure the document will be parsed the same way by different browsers.