$npx skillfedfor your agent

xmlformatter

Format and compress XML documents

Worth itPyPI XMLReleased May 202692.2K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — xmlformatter-0.2.9-py3-none-any.whl
v0.2.9 · released 2026-05-06 · Python >=3.2

Yes. xmlformatter is a lightweight, actively maintained tool with no external dependencies, a permissive MIT license, and no known vulnerabilities. Install it if you need to format, normalize, or compress XML documents—either programmatically or from the command line. The distinct handling of element vs. mixed content makes it useful for documents that blend structured data and natural language text.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low install friction with no runtime dependencies.
  • Active maintenance status with a recent release.

License · maintenance · safety

MIT (permissive) — MIT license permits use, modification, and distribution with minimal restrictions, making it suitable for both open-source and proprietary projects.

last release 2026-05-06 (100 days)

0 known vulnerabilities (OSV.dev, 2026-08-14) · 92,197 downloads/mo, #13,469 on PyPI

Verify before relying

import xmlformatter

formatter = xmlformatter.Formatter(indent="2", indent_char=" ")
formatter.format_file("/path/to/doc.xml")
  • Whether the package handles large XML files efficiently or has memory constraints
  • Performance characteristics when formatting deeply nested XML structures
  • Compatibility with XML schemas or DOCTYPE declarations
Same gist for agents: .md · .json

What it is and what it does

xmlformatter is a Python 3 XML formatting library that normalizes whitespace in XML documents according to a set of explicit rules. It distinguishes between element content (treated as structured data) and mixed content (treated as text), applying different formatting strategies to each. For element content, it removes leading and trailing whitespace and collapses whitespace sequences; for mixed content, it preserves text flow while normalizing spacing around inline elements. The package provides both a programmatic API via the Formatter class and a command-line tool (xmlformat) for standalone use.

The library supports customization through options like indentation width and character, output encoding, element preservation (to skip formatting subtrees), and compression modes. It can read from files, strings, or stdin, and write to files or stdout. The package is a Python 3 replacement for the older Python 2 XmlFormatter package and includes migration guidance for existing users.

Use it for

  • Pretty-print XML configuration files for readability and version control diffs
  • Minify XML documents to reduce file size for transmission or storage
  • Normalize whitespace in mixed-content XML (like XHTML or DocBook) while preserving text semantics
  • Automate XML formatting in build pipelines or pre-commit hooks via the command-line tool
  • Preserve specific XML subtrees (e.g. code blocks or literal content) while formatting the rest of a document

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

xmlformatter is a lightweight, actively maintained tool with no external dependencies, a permissive MIT license, and no known vulnerabilities. Install it if you need to format, normalize, or compress XML documents—either programmatically or from the command line. The distinct handling of element vs. mixed content makes it useful for documents that blend structured data and natural language text.

Install

xmlformatter on PyPI

Before you install

Low install friction with no runtime dependencies. Active maintenance status with a recent release.

License in practice

MIT license permits use, modification, and distribution with minimal restrictions, making it suitable for both open-source and proprietary projects.

Quickstart

import xmlformatter

formatter = xmlformatter.Formatter(indent="2", indent_char=" ")
formatter.format_file("/path/to/doc.xml")

Verify before relying

  • Whether the package handles large XML files efficiently or has memory constraints
  • Performance characteristics when formatting deeply nested XML structures
  • Compatibility with XML schemas or DOCTYPE declarations

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.2
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceActively maintained 100 days since the last release
First released
Downloads92,197 / month, #13,469 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Programming Language :: Python :: 3Topic :: Text Processing :: Markup :: XML

Evidence: xmlformatter-0.2.9-py3-none-any.whl

Tags

Capabilities
xml formatting and indentationxml whitespace normalizationxml minification compressionpretty-print xml documentsxml document cleanup
Topics
xml-formattingcli-tool

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “xml formatting and indentation”

  • xmlformatterFormats and compresses XML documents by applying distinct whitespace…
  • prettierfierReformats HTML and XML strings with intelligent inline-tag handling,…
  • reqifReqIF is a Python library for parsing, unparsing, formatting,…

Give your agent the search over MCP, or paste the wish link into any chat.

More XML packages

beautifulsoup4 Worth it
PyPI · Python Modules · released Jun 2026

Beautiful Soup parses HTML and XML documents into a navigable tree, providing Pythonic methods to search, iterate, and modify the parsed content.

Install it if you need to parse or extract data from markup documents.

MITpure Python · 3.7.0+
432.1Mdownloads / mo
lxml Worth it
PyPI · Python Modules · released May 2026

lxml provides Python bindings to libxml2 and libxslt, enabling parsing, validation, and transformation of XML and HTML documents through an ElementTree-compatible API with support for XPath, XSLT, and schema validation.

Install it if you need robust XML/HTML parsing, validation, or transformation; avoid it only if you must stay pure-Python and can accept slower performance.

permissive licensecompiled wheel · 3.8+
416.8Mdownloads / mo
defusedxml Worth it
PyPI · XML · released Mar 2021

Defusedxml hardens Python's standard XML libraries against XML bomb attacks and entity expansion exploits by providing drop-in replacements that disable dangerous parsing features by default.

Install it if your application parses any XML from untrusted sources.

permissive licensepure Pythondormant
241.2Mdownloads / mo
docutils With conditions
PyPI · Software Development · released May 2026

Docutils converts plaintext documentation in reStructuredText format into multiple output formats including HTML, XML, and LaTeX using a modular processing system.

BSD-3-Clausepure Python · 3.9+
225.6Mdownloads / mo
xmltodict Worth it
PyPI · XML · released Feb 2026

Converts XML to Python dictionaries and back, treating XML parsing and generation like working with JSON.

MITpure Python · 3.9+
127.1Mdownloads / mo
Sphinx Worth it
PyPI · Software Development · released Dec 2025

Sphinx generates professional documentation from reStructuredText source files, producing HTML, PDF, EPUB, and other formats with automatic cross-references, code highlighting, and hierarchical navigation.

BSD-2-Clausepure Python · 3.12+
91.8Mdownloads / mo

See also paragraphs · prettierfier · dicttoxml · compact-json · dict2xml · htmlmin2 · meld3 · et-xmlfile · objprint