public DTD buildDTD() {
// Only create an SGML DTD if there are characteristics of this DTD
// that can only be supported within an SGML DTD.
if (element2ETD.isEmpty() && nonReplaceableAttributes.isEmpty()
&& optionalEndTags.isEmpty()) {
return new XMLDTDImpl(this);
} else {
optimizeETD(element2ETD);
return new SGMLDTDImpl(this);