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.
| Query | Result |
|---|---|
//tag | All elements named tag |
/root/child | Elements at an exact path |
@attr | Elements with that attribute |
@attr=value | Elements 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.