Crate lazyxml

Crate lazyxml 

Source
Expand description

lazyxml is a lazy, non-standards-compliant XML 1.0 parser that ignores every mistake it can afford to.

§Example

for event in lazyxml::Reader::from_str("<Test>hello, world!</Test>") {
    println!("Event: {:?}", event);
}

§Why would I need this?

This crate was specifically made to ignore the same mistakes that ActionScript’s XML classes were looking past when parsing, for projects compatible with files that also worked in Adobe AIR, Flash, and any other product using AS3. This happens to be more or less doing little to no checks, which makes this crate very performant. As long as the XML is reasonably valid, it’ll work. Here’s an example of a valid empty element tag:

<Script time="0"a"'"''"'""'''32'34fdhfjsklflsjeje2!!!!!="e"what
='
   '/>

The attributes on this tag are parsed as:

  • Key: time | Value: 0
  • Key: a"'"''"'""'''32'34fdhfjsklflsjeje2!!!!! | Value: e
  • Key: what | Value: \n

If you’re looking for the opposite, a standards-compliant low-level XML parser, I highly recommend xmlparser.

§Note

This is rather early in development, and bangs (!) and processing instructions (?) aren’t supported yet.
So probably don’t use this at all until it hits 1.0.

Structs§

Attribute
Represents an XML attribute.
AttributeIter
Iterator over XML attributes.
Reader
Low level XML reader implemented as an Iterator producing events.
Tag
Represents an XML tag.
Text
Represents arbitrary text inside or outside of elements.

Enums§

Error
Generic XML parsing errors emitted by AttributeIter and Reader.
Event
Processed XML data, produced by a Reader.