oxml
🌐 FR , Changer de langue

Documentation

Moteur d'Évaluation XPath 1.0

Interrogez et parcourez des arbres XML avec une conformité totale et une optimisation poussée.

Syntaxe & Axes

oxml implémente l'intégralité de la spécification W3C XPath 1.0, y compris les 13 axes de navigation :

  • child:: et descendant::
  • parent:: et ancestor::
  • following-sibling:: et preceding-sibling::
  • attribute:: (ou @attr)
  • self:: et descendant-or-self:: (ou //)

Fonctions Standard

Support complet des bibliothèques de fonctions XPath 1.0 :

  • Fonctions de nœuds : count(), id(), local-name(), namespace-uri(), name()
  • Fonctions de chaînes : string(), concat(), starts-with(), contains(), string-length(), normalize-space()
  • Fonctions booléennes : boolean(), not(), true(), false()
  • Fonctions numériques : number(), sum(), floor(), ceiling(), round()

API Rust

Évaluez des requêtes directement en Rust :

use oxml::{Document, Value};

let xml = r#"<store><book price="20"/><book price="40"/></store>"#;
let doc = Document::parse(xml)?;

let books = doc.select("//book[@price > 25]")?;
assert_eq!(books.len(), 1);

let total: f64 = doc.eval_number("sum(//book/@price)")?;
assert_eq!(total, 60.0);