woxml::XmlWriter
The XmlWriter is designed to write xml in an efficient way without any DOM or other intermediate structures.
The implementation is based on the crate xml_writer by Piotr Zolnierek,
but can also be used in #[no_std] environments (use 'default-features = false').
It is not an exact drop-in-replacement for xml_writer's XmlWriter as the access to interiors is prohibitet, you have to use different constructors and accessors respectively.
It also is not possible to use it for all std::io::Write implementors,
as it is also usable in #[no_std] environments.
There is an own Write trait, which currently is implemented by the crate for
Vec<u8>bytes::BytesMut.
Future versions will add further implementations of Write.
If you need a missing implementation, please file an issue or create a pull request.
Usage
extern crate woxml;
use XmlWriter;
let mut xml = pretty_mode; // supply a `woxml::Write` implementor
xml.begin_elem;
xml.comment;
xml.begin_elem;
xml.attr_esc;
xml.attr;
xml.text;
xml.end_elem;
xml.begin_elem;
xml.cdata;
xml.end_elem;
xml.set_namespace;
xml.comment;
xml.elem;
xml.unset_namespace;
xml.end_elem;
xml.close; // This will also close all open elements
xml.flush;
println!
License
Licensed under either of
- Apache License, Version 2.0 LICENSE-APACHE or source
- MIT license LICENSE-MIT or source
at your option.
Contribution
Any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.