Validating xml against dtd

I am looking for an explanation on just why XML needs to be validated.I have been testing DTD's and Schema's for the past month and recently tried to find out why I am doing this.I know it makes the XML better and more Semantic but what are the overall benefits of validating XML? Sure, if you only write out some data for your own application to read it may be enough if it just works.

validating xml against dtd-15

But even within your application you may later choose to switch the parsing library and the new one may complain about errors the old one accepted and ignored like not properly escaping some characters.

Or, depending on the kind of data you store, some new characters may appear (maybe a user with a foreign name) and from that moment proper character set definitions may be important.

Same if you just send an XML file from Windows to a Linux system.

The closer you keep to definitions and validations the less likely you run in unexpected trouble when things change.

Not really because I never used the XML file until I had a Schema which was correct.

Last modified 27-Oct-2014 08:39