XMLStarlet
$ xml Community Low RiskXMLStarlet (xml or xmlstarlet) wraps libxml2 and libxslt into Unix subcommands (sel, val, tr, ed, fo, el) for querying XML via XPath, validating against XSD/DTD/RelaxNG, and applying XSLT stylesheets.
brew install xmlstarlet Extracts XPath nodes and validates XSD schemas deterministically via libxml2 without fragile regex XML parsing.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Non-interactive and deterministic exit codes, but emits XML/plain text (zero JSON support) and requires verbose -t -m -v template flags.
- No JSON output support
- Verbose XSLT-backed
-tflags andxmlvsxmlstarletbinary naming split
Read-only stdout by default; in-place file edits require explicit xml ed -L (--inplace).
- Stdout default; explicit
-Lrequired for in-place mutation
Widely packaged via Homebrew, apt, dnf, and Chocolatey, though the installed command name varies (xml vs xmlstarlet).
- Available via
brew install xmlstarletand Linux distro packages
Solid for XPath 1.0 queries, XSD validation, and XSLT 1.0 transforms, though modern tools (yq -p xml) are cleaner when JSON output is needed.
- Covers XPath, XSLT, XSD, and XML formatting
Mature legacy C codebase under MIT license with infrequent modern maintenance.
- Legacy
libxml2wrapper with minimal upstream changes
Detailed SourceForge User's Guide and subcommand --help pages.
- Official User's Guide at xmlstarlet.sourceforge.net
Security, Auth & Guardrails
None; operates purely on local XML/XSD/XSL files and stdin/stdout.
MIT open-source CLI; completely free.
# XMLStarlet (xml) Agent Rules - Note that the binary may be named `xml` (macOS Homebrew) or `xmlstarlet` (Debian/Ubuntu) depending on OS. - Pass `-N ns=<uri>` for namespaced XML documents, and prefer `xml ed` to stdout before using `--inplace` (`-L`).
Agent-Ready Command Recipes
Safe Read-Only Queries
xml sel -T -t -m "//item" -v "name" -n feed.xml
Queries //item/name nodes and prints one value per line without XML escaping.
xml val -e -s schema.xsd data.xml
Checks well-formedness and XSD compliance, printing errors to stderr with exit code 0 or 1.
Controlled Writes & Previews
xml ed -u "//config/port" -v "8080" config.xml > config.new.xml
Applies an XPath update non-destructively to a new file rather than passing --inplace.
Strengths for Agents
- + Reliable
libxml2/libxsltbacking for XPath selection and XSD/DTD validation. - + Pure C binary with fast execution and zero runtime interpreter overhead.
Caveats & Pitfalls
- ! No JSON output; XML-to-JSON conversion requires
yqorjc. - ! Binary name differs across OSes (
xmlon Homebrew/macOS vsxmlstarleton Debian/Ubuntu). - ! XPath 1.0 namespaces require explicit
-N prefix=uribindings or queries silently return empty.