Skip to content

This content is for v2.x version. Switch to the Stable version.

Roadmap

The v2.x line builds on the stable, round-trip-safe DOM from v1.x. Its headline goal is native XPath querying, plus supporting ergonomics for selecting and extracting data from a parsed tree.

Headline: XPath support Planned

Section titled “Headline: XPath support ”

Today you navigate the tree with structural helpers such as find_first_child, get_elements_by_tag_name and find_first_by_attribute. v2 aims to add a single expression-based entry point so you can locate nodes with familiar XPath syntax instead of chaining calls.

The target API is a query_xpath method on XmlDocument:

// Target API — not yet available.
let titles = document.query_xpath("//book[@id='bk101']/title")?;
for node_id in titles {
let title = document.get_element(node_id)?;
println!("{}", title.get_text_content());
}
CapabilityExampleStatus
Child & descendant steps/catalog/book, //titlePlanned
Attribute predicatesbook[@id=‘bk101’]Planned
Positional predicatesbook[1], book[last()]Planned
Wildcards/catalog/*, @*Planned
Namespace-qualified steps//t:book via a bound prefix mapExploring
Text & node tests//title/text()Exploring
  • Zero-copy over the existing DOM — XPath evaluation returns NodeId values into the current tree, with no separate document model.
  • Namespace-aware — expressions resolve prefixes through the same NamespaceDeclaration scope used elsewhere, keeping results round-trip-safe.
  • No unsafe — consistent with the rest of the crate.
  • Incremental — child/descendant axes and attribute predicates ship first; richer axes and functions follow.
AreaIntentStatus
Streaming / SAX-style readerEvent callbacks for very large documents without building a full DOM.Exploring
Pretty-printing optionOptional indentation on serialize alongside the existing compact output.Exploring
Broader encoding supportRead non-UTF-8 declarations by transcoding to UTF-8 on parse.Exploring