Interactive XML navigator and filter with XPath-like queries — inspired by jnv by ynqa.
xnv is a terminal-based interactive viewer for XML files. Type XPath-like queries to filter and explore the document tree in real time. Results update as you type. When you find what you need, press Enter twice to exit and print the query and output to stdout.
brew install jaedmunt/tap/xnvcargo install xnvDownload from the releases page for:
x86_64-unknown-linux-gnux86_64-unknown-linux-muslaarch64-unknown-linux-gnux86_64-apple-darwinaarch64-apple-darwinx86_64-pc-windows-msvcaarch64-pc-windows-msvc
# From a file
xnv data.xml
# From stdin
cat data.xml | xnv
# Start with a default query
xnv data.xml --default-filter '//item'
# Exit and write result to stdout
xnv data.xml --write-to-stdout| Query | Result |
|---|---|
| (empty) | Show the full document |
//tagname |
All elements named tagname |
/root/child |
Navigate by absolute path |
@attr |
All elements that have attribute attr |
@attr=value |
Elements where attr equals value |
//tag/text() |
Text values only — no XML tags |
//item → all <item> elements
/catalog/book → <book> elements at that exact path
@id → all elements with an id attribute
@type=premium → elements where type="premium"
//title/text() → just the text inside <title> tags
| Key | Action |
|---|---|
Ctrl+C |
Quit |
Enter × 2 |
Exit and print query + output |
Shift+↑ / Shift+↓ |
Switch focus: query editor ↔ XML viewer |
Ctrl+H |
Toggle help overlay |
Ctrl+T |
Toggle values-only mode |
Ctrl+Q |
Copy current query to clipboard |
Ctrl+O |
Copy current result to clipboard |
| Key | Action |
|---|---|
Tab |
Autocomplete XPath |
Ctrl+A |
Move to start of line |
Ctrl+E |
Move to end of line |
Alt+B / Alt+F |
Move by word |
Ctrl+W |
Delete previous word |
Alt+D |
Delete next word |
Ctrl+U |
Clear input |
| Key | Action |
|---|---|
↑ / ↓ |
Move cursor |
Enter |
Collapse / expand element |
Ctrl+P |
Expand all |
Ctrl+N |
Collapse all |
Ctrl+L |
Jump to top |
Ctrl+G |
Jump to bottom |
| Mouse scroll | Scroll results |
xnv loads its configuration from:
- Linux / macOS:
~/.config/xnv/config.toml - Windows:
%APPDATA%\xnv\config.toml
The file is created automatically on first run with defaults. You can override any setting — see default.toml for the full reference.
[xml]
indent = 4
[keybinds]
exit = ["Ctrl+C", "Ctrl+D"]
toggle_values = ["Ctrl+T"]
[keybinds.on_xml_viewer]
up = ["Up", "Ctrl+K"]
down = ["Down", "Ctrl+J"]- Real-time filtering — results update as you type with configurable debounce
- XPath-like queries —
//tag,/path/to/elem,@attr,@attr=value,/text() - Values-only mode — strip tags, show just text content (
//tag/text()) - Collapse / expand — fold any element subtree in the viewer
- Tab completion — autocomplete paths from the document
- Clipboard support — copy queries or results with a single keybind
- Animated prefix — reactive snake animation on the query prompt
- Double-Enter exit — print query + output without leaving the TUI manually
- Cross-platform — Linux, macOS, Windows
Requires Rust 1.85+.
git clone https://github.com/jaedmunt/xnv
cd xnv
cargo build --release
./target/release/xnv --helpInspired by jnv by ynqa — the JSON navigator this tool is modelled after.
Built with:
- roxmltree — XML parsing
- promkit — TUI widget framework
- tokio — async runtime
- cargo-dist — release infrastructure
MIT
