Skip to main content

Creates diffs of XML files

Project description

xmldiff

https://travis-ci.org/regebro/xmldiff2.svg?branch=master https://coveralls.io/repos/github/regebro/xmldiff2/badge.svg

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xmldiff-2.0b1.tar.gz (70.3 kB view hashes)

Uploaded Source

Built Distribution

xmldiff-2.0b1-py2.py3-none-any.whl (53.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page