RustyXML
RustyXML is a namespace aware XML parser written in Rust. Right now it provides a basic SAX-like API, and an ElementBuilder based on that.
The parser itself is derived from OFXMLParser as found in ObjFW https://webkeks.org/objfw/.
The current limitations are:
- Incomplete error checking
- Unstable API
The Minimal Supported Rust Version for this crate is Rust 1.40.0.
Examples
Parse a string into an Element
struct:
use Element;
let elem: = "<a href='//example.com'/>".parse;
Get events from parsing string data:
use ;
// Create a new Parser
let mut p = new;
// Feed data to be parsed
p.feed_str;
p.feed_str;
// Get events for the fed data
for event in p
This should print:
<a>
</a>
Build Element
s from Parser
Event
s:
use ;
let mut p = new;
let mut e = new;
p.feed_str;
for elem in p.filter_map
Build Element
s by hand:
let mut reply = new;
reply.tag
.tag_stay
.tag
.text;
Result (some whitespace added for readability):
Permission denied
Attribute Order
By default the order of attributes is not tracked. Therefore during serialization and iteration
their order will be random. This can be changed by enabling the ordered_attrs
feature.
With this feature enabled the order attributes were encountered while parsing,
or added to an Element
will be preserved.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.