Minimally intrusive XML editing using Python
stefan_ml at behnel.de
Wed Nov 18 14:15:07 CET 2009
Thomas Lotze, 18.11.2009 13:55:
> I wonder what Python XML library is best for writing a program that makes
> small modifications to an XML file in a minimally intrusive way. By that I
> mean that information the program doesn't recognize is kept, as are
> comments and whitespace, the order of attributes and even whitespace
> around attributes. In short, I want to be able to change an XML file while
> producing minimal textual diffs.
Take a look at canonical XML (C14N). In short, that's the only way to get a
predictable XML serialisation that can be used for textual diffs. It's
supported by lxml.
More information about the Python-list