skillfed

tree-sitter-xml

XML & DTD grammars for tree-sitter

tree-sitter-xml v0.7.0 2.2M downloads/30d#3,226 on PyPI
Permissive license MIT DORMANT released

What it is and what it does

tree-sitter-xml is a parser grammar for the tree-sitter parsing toolkit, providing syntax analysis for XML and DTD files. It follows the W3C XML 1.0 specification and related standards for schema and stylesheet associations. The package is a compiled grammar that integrates with tree-sitter's incremental parsing engine, allowing you to build syntax trees and perform structural analysis on XML documents.

This is a grammar distribution, not a standalone parser—it requires the tree-sitter Python bindings to actually parse files. It's designed for use in editors (Neovim, Emacs) and development tools that need to understand XML structure. With no runtime dependencies and prebuilt wheels for major platforms, installation is straightforward on supported systems.

Use it for:

  • Syntax highlighting and code navigation for XML files in editor plugins or language servers
  • Incremental parsing of XML documents in development tools to track structural changes
  • Building AST-based analysis or transformation tools for XML configuration files
  • DTD validation and schema-aware XML processing in custom parsing pipelines

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a tree-sitter parser grammar for XML and DTD files, enabling incremental parsing and syntax tree analysis of XML documents.

Yes, if you're building XML parsing or analysis tooling with tree-sitter. The grammar is permissively licensed, installs easily on modern platforms, and has no runtime dependencies. Dormant maintenance is not a blocker for a grammar package—it's stable and unlikely to need frequent updates. Install only if you already use or plan to use tree-sitter's Python bindings.

Install

tree-sitter-xml on PyPI

pip

pip install tree-sitter-xml

uv

uv add tree-sitter-xml

poetry

poetry add tree-sitter-xml

Installing tree-sitter-xml

Before you install

Medium install friction due to compiled wheels; prebuilt binaries available for common platforms (x86_64, arm64, macOS, Linux, Windows) and Python 3.9+. Dormant maintenance status (last release 2024-11-13, 639 days ago) means no active updates, though no recent issues reported.

License in practice

MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions, provided you retain the license notice.

Quickstart

pip install tree-sitter-xml

import tree_sitter_xml
# Use with tree-sitter Python bindings to parse XML

Requires Python 3.9 or later; tree-sitter Python bindings must be installed separately to actually parse documents.

Verify before relying

  • Whether tree-sitter Python bindings are automatically pulled in or must be manually installed
  • Specific performance characteristics for large or deeply nested XML documents
  • Completeness of DTD support and any known parsing limitations

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance dormant — 639 days since the last release
First released
Downloads 2,185,370/month — #3,226 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: tree_sitter_xml-0.7.0-cp39-abi3-macosx_10_9_x86_64.whl; tree_sitter_xml-0.7.0-cp39-abi3-macosx_11_0_arm64.whl; tree_sitter_xml-0.7.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; tree_sitter_xml-0.7.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl; tree_sitter_xml-0.7.0-cp39-abi3-musllinux_1_2_x86_64.whl; tree_sitter_xml-0.7.0-cp39-abi3-win_amd64.whl; tree_sitter_xml-0.7.0-cp39-abi3-win_arm64.whl

Keywords: incremental, parsing, tree-sitter, xml

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseTopic :: Software Development :: CompilersTopic :: Text Processing :: LinguisticTyping :: Typed

Tags

xml parser tree-sitterincremental xml parsingxml syntax treedtd parsertree-sitter grammar xmlxml ast parsingxml document analysis
parsingtree-sitterxml-grammar

More Linguistic packages