oxml-cli 0.0.3

Command-line XML querying, validation and formatting, powered by oxml
oxml-cli-0.0.3 is not a library.
Visit the last successful build: oxml-cli-0.0.11

Install

cargo install --git https://github.com/sebastienrousseau/oxml-cli

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
oxml query '//book/title' -t catalogue.xml

# Just the count
oxml query '//book' -c catalogue.xml

# A scalar expression behaves like the expression it is
oxml query 'count(//book)' catalogue.xml

# Validate, with violations on stderr so stdout stays clean
oxml validate schema.xsd catalogue.xml

# Compose
curl -s https://example.com/feed.xml | oxml query '//item/title' -t

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

at your option.