Expand description
A Rust implementation of the XQuery and XPath Data Model 3.1.
The library separates parsing from evaluation. An expression is compiled to create a ‘Sequence Constructor’. This constructor is then applied to a source document to produce a Sequence.
A Sequence is an ordered collection of zero or more Items, implemented as a Rust Vector. An Item is a Node, Function or atomic Value.
See the xslt module for an example of how to evaluate an XSL stylesheet.
Trees
The evaluator needs a tree that is both navigable and mutable. The Item module defines the Node trait that defines what the tree structure looks like. The module intmuttree is an implementation of the Node trait.
Parsing XML
Parsing XML documents is done using a parser combinator: parser.
Status
For XPath it provides most of v1.0 functionality, with some v2.0 and v3.1 features.
The XSLT implementation is bare-bones. It supports basic templating, literal result elements, attributes, and text. Also conditionals (if, choose), repetition (for-each, for-each-group), copying (copy, copy-of), and inclusion/importing.
NB, the library has not been extensively tested.
Plan
- Complete the XPath 1.0 implementation.
- Implement all v1.0 XSLT functionality.
- Implement all XPath 3.1 data model and functions.
- Complete the v3.1 XSLT engine.
Goals / Future Work
- The library should always return errors, i.e. it should not panic
- Make the library more idiomatically Rust
Contributions
We need your help!
- Download the crate and try it out. Tell us what you like or don’t like. How can it be improved?
- Let us know what doesn’t work. Submit a bug report.
- Do you need more documentation? There can never be enough!
- Add some tests.
- Write some code.
- Donate resources (i.e. $$$)
Re-exports
pub use xdmerror::Error;
pub use xdmerror::ErrorKind;
pub use value::Value;
pub use item::Item;
pub use item::Node;
pub use item::Sequence;
pub use item::SequenceTrait;
pub use xpath::parse;
pub use evaluate::Constructor;
pub use evaluate::Evaluator;
pub use evaluate::StaticContext;
pub use intmuttree::Document;
Modules
- Evaluate a sequence constructor
- A tree structure for XDM
- xrust::item
- A parser combinator, inspired by nom.
- xrust::qname
- xrust::value
- xrust::error
- xrust::xpath
- An XSLT compiler