I need to make a few changes to existing XML files, while preserving formatting and comments - everything except the minor changes I do should be untouched. I've tried xml.etree and lxml.etree with no success.
The XML is generated by my IDE, but its editor is lacking in functionality, so I have to make a few manual changes. I want to keep the formatting so the diffs are pretty and not polluting my history.
With the multitude of python XML libraries I thought I'd ask here if anyone has done something similar.
How many and what kind of changes do you need to make?  It sounds to me like you may be better served simply using a standalone XML editor (just Google for them, there are lots).  Frankly, I'm kind of surprised your IDE doesn't have adequate search-and-replace for your needs.  (Most of the ones I've seen even have regex facilities for this.)  If you really do need to write a program to make the XML changes, and you don't want to mess up the formatting and comments, your best bet may be to open the XML as a regular text file in Python, and use its regular expression library (import re) to do the search-and-replace.
Python library for editing XML preserving formatting and comments