xnv

Apr 2026 · github.com

xnv is a terminal viewer for XML. You type an XPath-like query and the document tree filters in real time. Press Enter twice when you’ve found what you need and it prints the query and the result to stdout. It’s inspired by jnv, which does the same for JSON.

Install it with cargo install xnv, or brew install jaedmunt/tap/xnv. There are prebuilt binaries for Linux, macOS and Windows on the releases page.

xnv data.xml
cat data.xml | xnv
xnv data.xml --default-filter '//item'

Queries cover the common cases.

QueryResult
//tagAll elements named tag
/root/childElements at an exact path
@attrElements with that attribute
@attr=valueElements where the attribute equals value
//tag/text()Just the text, no tags

Tab autocompletes paths, Shift and the arrow keys switch between the query and the tree, and Ctrl+H shows every keybinding.