Where to put formatting I am building a custom module to grab data from an XML feed, however some of the data comes in badly formatted and I would like to change some of it around (for example put line breaks after certain words). Where would be the most Drupaly place to put the code that does this? In the module's .inc file? Preprocess it in template.php? Or put it in a field template file?
I would add the necessary reformatting of the badly formatted XML to the input processing of the custom module (the one you're writing).

If that is not an option (e.g. if the client insists that the XML feed is saved verbatim), then I would create a custom filter for this content.  Drupal filters do not change the input - it only changes the presentation.