10 releases (5 stable)
1.3.0 | Mar 5, 2023 |
---|---|
1.2.1 | Feb 20, 2023 |
1.2.0 | Feb 3, 2021 |
1.1.0 | Jan 29, 2021 |
0.0.0 |
|
#2989 in Parser implementations
Used in 2 crates
19KB
312 lines
magnesium
A minimal XML iterator.
lib.rs
:
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);
}