Since incoming data is outside your control, always validate XML feeds against a Schema or DTD before it is processed.  If no Schema is provided, invent one.

While outgoing data is in your control, it pays to validate the outgoing data against a Schema to ensure data consistency.  

I've lost count of how many times I received XML messages from third parties that are invalid against the schema they gave us.  Sometimes the XML isn't even valid XML!

For non XML data, the same principle applies, validate at least on the way in.  For example, there is no point starting to process a .CSV file if the last line is truncated and the entire file is incomplete.

blog comments powered by Disqus