Caleb L wrote:
> Hello, I am searching for information specifically regarding the
> differences between the capabilities of XML Schemas and DTDs. I've only
> written Schemas before, not DTDs. From what I have read online, it seems as
> if the two are very similar in function (just different syntax) and have
> pretty much the same capabilities, yes? If someone could give me a few tips
> on the differences and/or give a few links to online articles comparing the
> two, your help would be greatly appreciated!
Here's a quick and almost certainly incomplete comparison, but it'll
give you the flavor of what each can do.
What DTDs and XML Schemas can both do:
- Define element types: Element type name + content model, where content
model consists of sequences, choices, and references to other element
types. Each sequence/choice/reference can occur 0/1, exactly once, 0 or
more, or 1 or more times. Also mixed content, PCDATA-only content, empty
content, and ANY content (mixed content with any other element defined
in the DTD/schema).
- Define attributes (name, type (ID, IDREF, NMTOKEN, CDATA, etc.),
default, whether required).
- Define notations.
What DTDs can do that XML Schemas cannot do:
- Define entities (parameter, general)
What XML Schemas can do that DTDs cannot do:
- complex types/extension/restriction
- data types (integer, date, etc.)
- all groups
- constraints (key/keyref/unique)
- substitution groups
- wild cards
- handle namespaces
- minOccurs/maxOccurs (except as noted above)
- local element types
- associate comments with particular definitions in a machine-readable