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-healeris not found, use.venv\Scripts\xml-healer.exe ...orpython -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
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f8691758b9aa52af29262c1190cd2b75a1496c4dc92017485294480a21a623d
|
|
| MD5 |
5eb1b920524b6ab535c0c4d7fa11aaf7
|
|
| BLAKE2b-256 |
45891cddf406278fa08034628e5674994144981e718dbf3d461705254e319f33
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e6b07c6ff54bf7b557a3c9c8d49bffce757c270542a32a7a38fdcccfa994875
|
|
| MD5 |
5520356f07fd1ac47c19868317ff72f3
|
|
| BLAKE2b-256 |
b300215e26c4aa435d42d10d6be239b4a6f424fbe3ee525420e4e628bce9389c
|