Tuesday, January 6, 2009

What is the difference between XSd and DTD and Validating a XML against XSD

What is the difference between XSd and DTD ?

Both of them achieve similar goals to define the structure of xml documents.XSd does in the language of xml itself,DTD uses its own language.Xsd is more expressive and dtd is less expressive.XSD allows for extensible schmeas,has namespace support, has content directives,offers tighter integration with the testing tools etc.DTD has none of these features.XSD is newer and DTD is older.DTD is also used to define other types of documents(types other than XML).


Validating a XML against XSD ?

To check the validity of xml,it has to first be well formed.The XML specification has some rules on well-formedness of xml.Once a documents is found to be well formed ,it can be validated against a schema that defined it,the schema can be defined using many schema definitions.The most popular ones are XSD,DTD and RELAX-NG.To validate a program is used.Some IDEs,MS VisualStudio.YOu can also find programs on the net that perform validation of xml files.

No comments: