libxml 0.0.6

A Rust wrapper for libxml2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
extern crate libxml;

use libxml::parser::{Parser};
use libxml::xpath::Context;


fn main() {
  let parser = Parser::default();
  let doc = parser.parse_file("tests/resources/file01.xml").unwrap();
  let context = Context::new(&doc).unwrap();
  let result = context.evaluate("//child/text()").unwrap();

  for node in result.get_nodes_as_vec().iter() {
      println!("Found: {}", node.get_content());
  }
}