A simple example where validation seems like it should always be done: when an application that depends on its XML conforming to a particular schema receives XML from an external source. In the real world, we receive XML purchase orders conforming to the cXML spec over HTTP from a different organization. Validation quickly gets us started with the processing of the PO.
In such a case validation accomplishes the important task of assuring a basic level of conformance to some specs of the application, and typical applications will additionally check the message in ways that DTDs or Schemas couldn't necessarily help with, but that is not to say DTDs or Schemas are incomplete.
At the other end of the spectrum would be the pointless tactic of validating the same file validated 20 seconds ago, the same application validating the same file sitting on the same server.
If you are talking about publisher and subscriber applications, the big question is how close are the two systems to each other? What organization, what network, what machine, what file? It would range from two distinct applications at different organizations to two modules of a single application accessing a single file, and at the one extreme you should validate and the other you shouldn't.
From: Magick, Brian [mailto:Brian.Magick@COMPAQ.com]
Sent: Wednesday, October 31, 2001 6:25 PM
Subject: [xml-dev] When to Validate XML?