[][src]Crate magnesium

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

The processing is quite simplistic. The full XML spec probably isn't followed. It doesn't decode any of the special character replacements for you.

The crate is intended for when you have a fairly basic XML file and you just need to walk through and scrape the data. For example, when parsing gl.xml or vk.xml.

Only requires core, doesn't allocate.

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

ElementIterator

An iterator to walk the elements of some XML data.

TagAttribute

An attribute within a Start or Empty tag's data.

TagAttributeIterator

Iterator to walk through a tag's attribute string.

Enums

XmlElement

An element within an XML structure.

Functions

skip_comments

Filters out XmlElement::Comment(_).

skip_empty_text_elements

Filters out XmlElement::Text(t) when t is only whitespace.