Install
Usage
oxml <COMMAND> [OPTIONS] [FILE]
COMMANDS:
query <XPATH> Evaluate an XPath expression
validate <XSD> Validate against an XML Schema
stats Summarise the document
check Report whether the document is well-formed
FILE defaults to standard input, so it composes with pipes.
Examples
# Every title in the document
# Just the count
# A scalar expression behaves like the expression it is
# Validate, with violations on stderr so stdout stays clean
# Compose
|
Exit status
Chosen so the tool is useful in a shell:
| Code | Meaning |
|---|---|
0 |
Success; for validate, the document conforms |
1 |
The document is invalid, or no nodes matched |
2 |
A usage or I/O error |
oxml query ... && echo found therefore does what you would expect.
Design
Argument parsing is hand-rolled rather than taken from a crate. The surface is four subcommands and a handful of flags; a dependency would be more code to audit than it removes, and this binary is meant to be cheap to trust.
Diagnostics go to stderr, results to stdout, so the tool composes in a pipeline without validation output contaminating the data.
The oxml suite
Every member ships the same version number, so there is never a
compatibility table to consult. Versions advance in 0.0.1 steps along
the 0.0.x line; 0.1.0 follows 0.0.999.
| Crate | What it is |
|---|---|
oxml |
Core — parser, tree, XPath 1.0 |
oxml-cli |
Command-line querying and validation |
oxml-lsp |
Diagnostics for editors |
oxml-mcp |
Model Context Protocol server |
oxml-wasm |
WebAssembly bindings |
xmlschema |
XSD validation |
Contributing
See CONTRIBUTING.md. By participating you agree to the Code of Conduct.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.