tags:

views:

70

answers:

1

Hi, I am a bit confused whether to go for DTD or XSD when designing. Could any one please help?

+5  A: 

I would say that XSD allows to specify more precisely what your XML documents can contain, while a DTD will only allow you validate the presence (and very basic validation of numbers) of tags and attributes.

For example, an XML Schema allows the content of elements/attributes to be validated against data types -- while DTD don't.

XML Schema, also, are, like their name indicates, XML Documents -- which means they can be manipulated exactly the same way you're manipulation your other XML Documents.


I would say that, if your goal is to describe what an XML document can contain, in order to validate it, you should use XML Schema.

Still, DTD have at least one great advantage : they're simpler to both read and write -- which might (or not) matter.

Pascal MARTIN