Skip to main content

A tool for healing and diffing broken XML.

Project description

xml-healer

A Python tool for healing and diffing broken XML. Automatically fixes common XML errors and provides a diff of changes.

Features

  • Repairs broken or malformed XML
  • Detects and reports tag mismatches, missing/extra tags, and text changes
  • Provides a diff of all structural and tag changes
  • Easy to use API and CLI

Usage (Python)

from healer.xml import heal_xml

xml = "<a><Name>John</NAme>"
result = heal_xml(xml)
print(result.fixed_xml)
print(result.diff)

Usage (Command Line)

You can use the CLI after installing:

xml-healer '<a><Name>John</NAme>'

Or to heal an XML file:

xml-healer path/to/file.xml --file

If you have issues with the CLI script (especially on Windows or in a virtual environment), use:

python -m healer.cli '<a><Name>John</NAme>'

This always works as long as your environment can import the healer package.

Troubleshooting CLI

  • Always activate your virtual environment before installing or running the CLI.
  • If xml-healer is not found, use .venv\Scripts\xml-healer.exe ... or python -m healer.cli ....
  • If you see ModuleNotFoundError: No module named 'healer', you are running the CLI from a Python environment that cannot see your package. Activate your venv or reinstall in the correct environment.
  • For global CLI, install from PyPI in a clean environment.

Installation

pip install xml-healer

Testing

Run all tests with:

pytest

License

MIT

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

xml_healer-1.2.4.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xml_healer-1.2.4-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file xml_healer-1.2.4.tar.gz.

File metadata

  • Download URL: xml_healer-1.2.4.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for xml_healer-1.2.4.tar.gz
Algorithm Hash digest
SHA256 4f8691758b9aa52af29262c1190cd2b75a1496c4dc92017485294480a21a623d
MD5 5eb1b920524b6ab535c0c4d7fa11aaf7
BLAKE2b-256 45891cddf406278fa08034628e5674994144981e718dbf3d461705254e319f33

See more details on using hashes here.

File details

Details for the file xml_healer-1.2.4-py3-none-any.whl.

File metadata

  • Download URL: xml_healer-1.2.4-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for xml_healer-1.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6e6b07c6ff54bf7b557a3c9c8d49bffce757c270542a32a7a38fdcccfa994875
MD5 5520356f07fd1ac47c19868317ff72f3
BLAKE2b-256 b300215e26c4aa435d42d10d6be239b4a6f424fbe3ee525420e4e628bce9389c

See more details on using hashes here.

Supported by

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