Crate magnesium

source ·
Expand description

This crate provides very a simplistic iterator for stepping over XML data.

Only requires core, doesn’t allocate, doesn’t use unsafe.

The processing is quite simplistic, and the iterator will simply fail and end the iteration if there’s a problem. This doesn’t do any special character replacement for you.

The crate is intended for when you have a fairly basic XML file that is assumed to be “non-hostile”, and you just need to walk through and scrape the data. For example, when parsing gl.xml or vk.xml.

Example Usage

use magnesium::*;

let xml_string = r#"
  <?xml version="1.0" encoding="UTF-8"?>
  <!-- just imagine we had a whole file here -->
  <registry>
    <enums namespace="Graphics" group="Polygon">
      <enum value="0" name="GRAPHICS_POINTS"/>
      <enum value="1" name="GRAPHICS_LINES"/>
    </enums>
  </registry>
"#;

for element in ElementIterator::new(xml_string) {
  println!("{:?}", element);
}

Structs

Enums

Functions