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.3.tar.gz (10.4 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.3-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xml_healer-1.2.3.tar.gz
  • Upload date:
  • Size: 10.4 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.3.tar.gz
Algorithm Hash digest
SHA256 a3e234e4f849519f9b1193bded04ae740d6aff6393c4374751c4356131f00f4d
MD5 791240e4ae0b15017f7828aef94dd9cd
BLAKE2b-256 2ae4ee2cecef88325b35d4705c16bd8ee7a9808445811a0ca7c6ccff51d7b28a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xml_healer-1.2.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d7f4b5e04fe586260d9357b179d407ed92e4cba96273b9292be64cbca17995a2
MD5 c8983d45b887d2c04cd6a88b3996c3bd
BLAKE2b-256 a3061105cafe1cb882a3554825d23ef0c6138dbdb06125c3d5668eb036bbe3c7

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