Pretty-print XML and HTML files in a light, YAML-like, readable format
Project description
Unxml
Simplify and "flatten" XML files into a YAML-like readable format.
This is a Rust clone of the original unxml F# tool.
See it in action → — a gallery of
real-world XML documents, schemas, stylesheets, and Schematron rules rendered
with unxml, with original-vs-rendered size comparisons.
Installation
Using uv (Easiest)
Install the published wheel from PyPI as a standalone tool:
uv tool install unxml-rs
This puts the unxml command on your PATH. To try it without installing anything:
uvx --from unxml-rs unxml <xml_file>
Pre-built Binaries (Recommended)
Download the latest release for your platform from the GitHub Releases page:
- Linux (x86_64):
unxml-linux-x86_64.tar.gz - Windows (x86_64):
unxml-windows-x86_64.zip - macOS (Intel):
unxml-macos-x86_64.tar.gz - macOS (Apple Silicon):
unxml-macos-arm64.tar.gz
Extract the archive and place the unxml binary in your PATH.
From Source
git clone https://github.com/yourusername/unxml-rs
cd unxml-rs
cargo install --path .
Using Cargo
cargo install unxml
Usage
unxml <xml_file>
By default files render as plain XML. Pass --auto to pick the processing mode
from each file's extension:
| Extension | Mode applied |
|---|---|
.xsl .xslt |
--xslt |
.sch |
--schematron |
.xsd |
--xsd |
An explicit mode flag (--xslt, --schematron, --xsd, --special) always
overrides autodetection.
Each mode rewrites its vocabulary into a terser pseudocode. The full set of transformations, with side-by-side samples, is documented per format:
- XSLT transformations —
xsl:*stylesheets - XSD transformations —
xs:*/xsd:*schemas - Schematron transformations —
.schrule schemas
Syntax-highlighted output (--bat)
unxml --bat some.xsd # implies --auto (detects --xsd), pipes through `bat -l unxml`
--bat renders the output through bat using
the bundled unxml grammar (see editor/) for paged, colourised display. If
bat is not installed it falls back to plain stdout.
Hiding noisy namespace prefixes (--hide-ns)
Vocabularies like UBL bury the signal under repeated prefixes (cbc:, cac:).
--hide-ns drops the named prefixes from element names — and their xmlns:
declarations — so the output reads as bare local names:
unxml --hide-ns cbc,cac invoice.xml # repeatable and comma-separated
Signal-carrying prefixes you don't list (e.g. ext:, bim:) are kept, so an
extension subtree still stands out.
Under --auto/--bat, unxml also sniffs the document type and hides a
sensible set automatically. Currently it recognises UBL instance documents
(an unprefixed root such as <Invoice> in a UBL namespace) and hides whichever
prefixes are bound to the Common Basic/Aggregate Components namespaces. A
stylesheet or schema that merely references UBL (e.g. an xsl:stylesheet
translating to UBL) is left untouched, since there the prefixes are real syntax.
Introduction
This command line application was developed for comparing XML files (e.g. database/application state dumps). It takes an XML file and converts it to a YAML-like syntax that is easier to read and compare.
Example
Given this XML input:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<PackAsTool>true</PackAsTool>
<Description>Unxml 'pretty-prints' xml files in light, yamly, readable format</Description>
<PackageVersion>1.0.0</PackageVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="FileSystemHelper.fs"/>
<Compile Include="MutableCol.fs"/>
<Compile Include="Program.fs" />
</ItemGroup>
</Project>
The output would be:
Project
[Sdk]: Microsoft.NET.Sdk
PropertyGroup
OutputType = Exe
TargetFramework = netcoreapp2.1
PackAsTool = true
Description = Unxml 'pretty-prints' xml files in light, yamly, readable format
PackageVersion = 1.0.0
ItemGroup
Compile
[Include]: FileSystemHelper.fs
Compile
[Include]: MutableCol.fs
Compile
[Include]: Program.fs
Key Features
- Attributes in Square Brackets: Element attributes are displayed as
[attribute]: value - Text Content with Equals: Element text content is shown as
ElementName = text content - Hierarchical Indentation: Nested elements are properly indented
- Clean Format: Easy to read and compare, great for diffing
Technical Details
- Built with Rust for performance and safety
- Uses
quick-xmlfor fast XML parsing - Uses
clapfor command-line argument parsing - Proper error handling with
anyhow
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Creating Releases
To create a new release:
- Update the version in
Cargo.tomlandsrc/main.rs - Commit the version changes
- Create and push a version tag:
git tag v1.0.1 git push origin v1.0.1
- The GitHub Actions workflow will automatically build binaries for all platforms and create a release
The CI workflow runs on every push to ensure code quality with formatting checks, linting, and tests.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
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 unxml_rs-1.3.0-py3-none-win_amd64.whl.
File metadata
- Download URL: unxml_rs-1.3.0-py3-none-win_amd64.whl
- Upload date:
- Size: 806.7 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c654e2fe9c0ab4ca6649db0838ffab06cd34cf1ef975d9f7f4809af4976598c
|
|
| MD5 |
f86f988e7bf1e64e9278681d2dd692eb
|
|
| BLAKE2b-256 |
49847a63a1bf6f04cc23c529f4405326691c7204f785709911e98c0698bc83b1
|
Provenance
The following attestation bundles were made for unxml_rs-1.3.0-py3-none-win_amd64.whl:
Publisher:
release.yml on vivainio/unxml-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unxml_rs-1.3.0-py3-none-win_amd64.whl -
Subject digest:
4c654e2fe9c0ab4ca6649db0838ffab06cd34cf1ef975d9f7f4809af4976598c - Sigstore transparency entry: 1886919943
- Sigstore integration time:
-
Permalink:
vivainio/unxml-rs@fc820b9dae40565c2aa601b2cb30bf2d1e9e2527 -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/vivainio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fc820b9dae40565c2aa601b2cb30bf2d1e9e2527 -
Trigger Event:
push
-
Statement type:
File details
Details for the file unxml_rs-1.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: unxml_rs-1.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 994.9 kB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce35188347e0deec5cc6374ed59d42b5a968889b3ee0a6a29d074028ceeeeba7
|
|
| MD5 |
6eb37a4b0b53ce706185f338722cf176
|
|
| BLAKE2b-256 |
38ce611735b19826608c1dc534607269b2da8955793b80a546641bd06a4333e0
|
Provenance
The following attestation bundles were made for unxml_rs-1.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on vivainio/unxml-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unxml_rs-1.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
ce35188347e0deec5cc6374ed59d42b5a968889b3ee0a6a29d074028ceeeeba7 - Sigstore transparency entry: 1886919572
- Sigstore integration time:
-
Permalink:
vivainio/unxml-rs@fc820b9dae40565c2aa601b2cb30bf2d1e9e2527 -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/vivainio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fc820b9dae40565c2aa601b2cb30bf2d1e9e2527 -
Trigger Event:
push
-
Statement type:
File details
Details for the file unxml_rs-1.3.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: unxml_rs-1.3.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 902.5 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6df32fe6798648ccbf1c5433bde33e357ee335914357110e1cc698c7bb1a36e
|
|
| MD5 |
9ec5429f8329d5b077380342633c09c7
|
|
| BLAKE2b-256 |
8a9bc646ad15989f34f3a9fb1c4d88bcddaef056a5775833a5dbb9e4550b3080
|
Provenance
The following attestation bundles were made for unxml_rs-1.3.0-py3-none-macosx_11_0_arm64.whl:
Publisher:
release.yml on vivainio/unxml-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unxml_rs-1.3.0-py3-none-macosx_11_0_arm64.whl -
Subject digest:
a6df32fe6798648ccbf1c5433bde33e357ee335914357110e1cc698c7bb1a36e - Sigstore transparency entry: 1886919744
- Sigstore integration time:
-
Permalink:
vivainio/unxml-rs@fc820b9dae40565c2aa601b2cb30bf2d1e9e2527 -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/vivainio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fc820b9dae40565c2aa601b2cb30bf2d1e9e2527 -
Trigger Event:
push
-
Statement type:
File details
Details for the file unxml_rs-1.3.0-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: unxml_rs-1.3.0-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 922.6 kB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fc84d349a7fad745471f99ba2cbf6d6f1d139f52c11b2edba8dfc277d4eb5ba
|
|
| MD5 |
1d0a32faea5030b4c5bd2c3126c74bea
|
|
| BLAKE2b-256 |
34f1686feba4f126f4cedd764a1e918b0afdd0198463140070947b90d106c749
|
Provenance
The following attestation bundles were made for unxml_rs-1.3.0-py3-none-macosx_10_12_x86_64.whl:
Publisher:
release.yml on vivainio/unxml-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unxml_rs-1.3.0-py3-none-macosx_10_12_x86_64.whl -
Subject digest:
4fc84d349a7fad745471f99ba2cbf6d6f1d139f52c11b2edba8dfc277d4eb5ba - Sigstore transparency entry: 1886919331
- Sigstore integration time:
-
Permalink:
vivainio/unxml-rs@fc820b9dae40565c2aa601b2cb30bf2d1e9e2527 -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/vivainio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fc820b9dae40565c2aa601b2cb30bf2d1e9e2527 -
Trigger Event:
push
-
Statement type: