Creates diffs of XML files
Project description
xmldiff
xmldiff is a library and a command line utility for making diffs out of XML.
xmldiff 2.0 is a complete, ground up pure-Python rewrite of xmldiff 1.x. xmldiff 2.x had various problems, mainly that the code is complex and unpythonic, making it hard to maintain and fix bugs, there is also an infinite loop in certain cases, and the c implementation leaks memory, as well as being hard to use as a library.
xmldiff 2.0 is currently significantly slower than xmldiff 2.x, but this may change in the future. Currently we make no effort to make xmldiff 2.0 fast, we concentrate on making it correct and usable.
xmldiff aims to have 100% test coverage. Python 2.7 support will be dropped soon.
The diff algorithm is based on “Change Detection in Hierarchically Structured Information”, and the text diff is using Googles diff_match_patch algorithm.
Contributors
Lennart Regebro, lregebro@shoobx.com (main author)
Stephan Richter, srichter@shoobx.com
Quick usage
>From the commandline:
$ xmldiff file1.xml file2.xml
As a library:
from lxml import etree from xmldiff import main, formatting differ = diff.Differ() diff = main.diff_files('file1.xml', 'file2.xml', formatter=formatting.XMLFormatter()) print(diff)
There is also a method diff_trees() that take two lxml trees, and a method diff_texts() that will take strings containing XML.
Changes
2.0b1 (2018-09-03)
A complete, bottom-up, pure-python rewrite
New output formats:
A list of actions (similar but not compatible with the old format)
XML with changes marked though tags and attributes
RML aware XML where tags containing text are semantically diffed, useful for human output such as converting to HTML or PDF
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for xmldiff-2.0b1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a15649073d795f2a742f0c46f44ebc732727ae201cf92e796ffb7b31eaebf59 |
|
MD5 | 0003996e2c8b62541743c80f1367925f |
|
BLAKE2b-256 | 65350820f8a49e5812dbcdb2aee651f19df8bf7c67d379e449699ed4ede5df51 |