Xml-rs v0.2.0, with full-featured document writer support and lots of refactoring


Finally, I’ve found some time to work on my xml-rs library. It is a pure-Rust implementation of XML 1.0/1.1-compliant streaming parser and streaming writer. I’ve just published v0.2.0 of xml-rs on crates.io.

While XML was a very popular data exchange format a decade or so ago, it is currently being consistently pushed out of almost all areas in favor of JSON and other similar lightweight markups. However, there are still lots of places where XML is used quite heavily, most notable are enterprise systems (SOAP, for example) but there are also more “consumer”-level systems, for example, UPnP protocol or configuration files of various applications, including those working closely with an OS, for example, polkit in Linux systems or plist files in Mac OS X. Therefore, supporting processing of XML documents is essential for any language ecosystem. xml-rs aims to provide a comprehensive set of tools for working with XML in Rust. It was one of the first libraries published on crates.io, first written even before Cargo was available, and one of the first libraries for XML processing in Rust.

In this version a streaming XML document writer is finally implemented. It is mostly full-featured (some things like writing DTDs are not yet supported), and it is also pretty configurable too, for example, you can fine-tune indentation options for pretty-printing your XML documents.

This version is not backwards-compatible. I’ve brought the API up to modern Rust standards. For example, EventReader now implements IntoIterator, and the resulting iterator yields Result<XmlEvent>. There were changes in module structure as well, and some redundant utilities were removed altogether. I’ve also added lots of documentation and fixed some small reported bugs from the issue tracker.

Also this release includes massive refactoring of parser internals. Hopefully it would make changing it much easier, for example, I expect that adding support for parsing embedded DTDs will be simpler than before.

I have lots of plans for xml-rs, the largest one being support for DOM-based XML document processing. Before this, though, I’d like to finish remaining bits of XML standard support, for example, proper parsing of DTDs and references. I’m not sure about the timeline, though, because I’m currently preparing my PhD thesis and there is also a lot of work at my primary job. But I’ll try to do my best :slight_smile:

Github, crates.io, docs, issues


I’ve yanked 0.2.0 as it contained a pretty nasty regression (#105). 0.2.1 contains the fix.