rust-libxml
Sometimes "use libxml2" is not laziness, it is the requirement: the documents were written against its parser, its XPath or its recovery behaviour. This wraps it instead of hiding it.
What changes for you
- Same parsing, Rust memory handling. Nodes and documents are
freed when they go out of scope; no manual
xmlFreebookkeeping. - Mutation made explicit. Interior mutability is wrapped so the borrow rules apply to libxml2 objects too.
- Honest about coverage. It wraps a subset of libxml2 and says so, rather than pretending to be complete.
Getting it
The crate is libxml on crates.io; this repository is the maintainer's
working tree.
cargo add libxmluse libxml::parser::Parser;
let document = Parser::default().parse_string("<root><child/></root>")?;
for node in document.child_nodes() {
println!("{}", node.get_name());
}