xml-doc is a rust library to read, modify, and write XML documents.
It's aim is to be able to read any xml files, and modify only the parts you want to.
Features:
Due to its architecture, you can't exchange nodes or elements between documents. If your project modifies multiple xml documents at the same time, this library may not be a good fit.
```rust use xml_doc::{Document, Element};
let XML = r#"
let doc = Document::parsestr(XML).unwrap(); let package = doc.rootelement().unwrap(); let metadata = package.find(&doc, "metadata").unwrap(); let title = metadata.find(&doc, "title").unwrap(); title.set_attribute("xml:lang", "en");
// Add an element to metadata:
let newxml = doc.writestr(); ```
To run benchmark: cd benches ; cargo bench
.
tiny(4.8KB) medium(1.5MB) large(25MB) medium(UTF-16)
xml_doc v0.1.0: 88.27us 35.11ms 370.35ms 36.29ms
minidom v0.12.0: 86.41us 47.64ms 612.22ms
roxmltree v0.14.1: 53.96us 18.62ms 353.33ms
xmltree v0.10.3: 4292.9 us 1329.4 ms 22442. ms
Only roxmltree which doesn't support writing, is considerably faster than xml_doc. You can see the result of the benchmarks here.