Just a point for the sake of providing a background to my question.
While I totally agree with your idea of fixing the problems at the source instead of patching the result at the end, I still need some fixing code. Because I am replacing locally (with some others) the outsourced team that did a very bad design and code, and that code produced for several years a big amount of (broken-but-visually-looking-ok) html files. While a DB is involved at some point, they choose to keep in a filesystem the data presented in the html files for history instead of the source data. The producing code is being fixed, but we still need to access the data (to separate the data and the way it is displayed).
And BTW, I have nothing against Indians in themselves -they seem to have some skilled people in the academic field-, but the sad point is that the company made a deal with a big indian body seller that provided junior skilled guys billed as seniors...
The best programs are the ones written when the programmer is supposed to be working on something else. - Melinda Varian