Minimally intrusive XML editing using Python

Nobody nobody at nowhere.com
Mon Nov 23 14:49:49 EST 2009


On Mon, 23 Nov 2009 17:45:24 +0100, Thomas Lotze wrote:

>> What's your real problem, or use case?  Are you just concerned with 
>> diffing, or are others likely to read the xml, and want it formatted the 
>> way it already is?
> 
> I'd like to put the XML under revision control along with other stuff.
> Other people should be able to make sense of the diffs and I'd rather not
> require them to configure their tools to use some XML differ.

In which case, the data format isn't "XML", but a subset of it (and
probably an under-defined subset at that, unless you invest a lot of
effort in defining it).

That defeats one of the advantages of using a standardised "container"
format such as XML, i.e. being able to take advantage of existing tools
and libraries (which will be written to the offical standard, not to your
private "standard").

One option is to require the files to be in a canonical form. Depending
upon your revision control system, you may be able to configure it to
either check that updated files are in this form, or even to convert them
automatically.

If your existing files aren't in such a form, there will be a one-time
penalty (i.e. a huge diff) when converting the files.





More information about the Python-list mailing list