oxml
🌐 EN , Change language

v0.0.13 pre-1.0 · MIT / Apache-2.0

oxml is pre-1.0. APIs may change between 0.0.x releases.

Query and Edit XML in Safe Rust.

Parse, mutate, query with XPath 1.0, and validate with XSD natively, in the browser with WebAssembly, or from an AI agent via MCP. No unsafe code, no C dependencies.

Get Started View Architecture

Interconnected digital nodes and data structures representing XML DOM trees and XPath traversal

One Engine, Four Runtimes, One Version Number

Run the same memory-safe XML engine natively in Rust, via terminal CLI, inside Claude and AI agents with MCP, or in the browser with WebAssembly.

// Pure Rust XML processing with full XPath 1.0
use oxml::{parse, XPath};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let doc = parse("<book id='b1'>Dune</book></library>")?;
    let xpath = XPath::compile("//book[@id='b1']/text()")?;
    assert_eq!(xpath.evaluate(&doc).to_str(&doc), "Dune");
    println!("Parsed and queried with 100% safe Rust!");
    Ok(())
}

Why oxml

Every component is engineered for reliability, safety, and predictability across native Rust, CLI pipes, and browser environments.

  • Zero Unsafe Code

    Enforced with #![forbid(unsafe_code)] at compile time. Zero raw pointer arithmetic, zero transmute tricks, zero undefined behaviour risks.

  • Generational Arena Tree

    Cache-friendly contiguous arena with O(1) node recycling. Removed elements reuse slots with bumped generations, preventing stale handles.

  • XPath 1.0 Engine

    Full specification evaluator supporting 13 axis steps, predicates, standard functions (count, contains, starts-with), and variable resolution.

  • Unified Ecosystem

    CLI tool, WebAssembly bundle, JSON-RPC, LSP server, and MCP agent toolkit, all shipping under one version number with zero dependency drift.

How oxml Compares to Rust XML Peers

An honest look at capabilities across the Rust ecosystem, and when to pick something else.

Capability / Guaranteeoxmlquick-xmlroxmltreexotxee
Memory Safety#![forbid(unsafe_code)]Safe RustSafe RustSafe RustSafe Rust
DOM Tree & MutationMutable Arena DOM (O(1))Streaming (No DOM)Read-Only (No DOM edit)Mutable Arena DOMRead-Only Tree
XPath SpecificationW3C XPath 1.0None (Manual events)None (Cursor traversal)None (Tree traversal)W3C XPath 3.1
XML Schema (XSD)Partial (see coverage)NoneNoneNoneNone
Browser WebAssemblyNative (<220 KB, 0 C deps)Supported (core reader)Supported (read-only)Supported (tree only)Supported (engine)
AI Agent Tools (MCP)Native (oxml-mcp)NoneNoneNoneNone
Pick this crate when...You need mutable DOM, XPath 1.0, and WASM under one safe, versioned crateYou need maximum streaming throughput on gigabyte files without a DOMYou need a lightweight, read-only cursor tree for static documentsYou need fine-grained XML tree manipulation with full namespace supportYou need XPath 3.1, XQuery, or XSLT 3.0 processing

When Not to Use oxml — Honestly

Every architecture involves deliberate trade-offs. We recommend these alternatives when your requirements match their strengths:

Gigabyte Streaming (Without a DOM)

If you are processing multi-gigabyte log or financial transaction streams where building a document tree in memory is unnecessary, pick quick-xml. Its pull-based token parser avoids heap allocation overhead.

XPath 2.0+ / XQuery / XSLT

If you need XPath 2.0/3.1 functions, regular expressions, or XSLT stylesheets, pick xee (pure Rust) or Saxon. oxml focuses strictly on W3C XPath 1.0 compliance.

Full XSD 1.1 Complex Identity Constraints

If you require exhaustive W3C XML Schema 1.1 validation with complex schema redefinitions, pick libxml2 or Saxon until xmlschema achieves full 1.0 maturity.

What We Measure, and How

Validated against official W3C XML conformance suites and benchmarked against reproducible baselines.

0
Unsafe blocks, enforced by #![forbid(unsafe_code)] at compile time
2.5x
Throughput vs byte-by-byte scanning on SWAR delimiter benchmark
95.2%
Pass rate on W3C XML Schema 1.0 core test suite subset
O(1)
Positional index predicates (e.g. [N] lookups) in generational arena

Install oxml Today