serde-xml-rs

Build Status

xml-rs based deserializer for Serde (compatible with 0.9+)

Usage

Use serde_xml_rs::deserialize(...) on any type that implements std::io::Read as following:

```rust

[macrouse] extern crate serdederive;

extern crate serdexmlrs;

use serdexmlrs::deserialize;

[derive(Debug, Deserialize)]

struct Item { pub name: String, pub source: String }

[derive(Debug, Deserialize)]

struct Project { pub name: String,

#[serde(rename = "Item", default)]
pub items: Vec<Item>

}

[test]

fn itworks() { let s = r##" "##; let project: Project = deserialize(s.asbytes()).unwrap(); println!("{:#?}", project); } ```

Alternatively, you can use serde_xml_rs::Deserializer to create a deserializer from a preconfigured xml_rs::EventReader.

Parsed representations

Deserializer tries to be as intuitive as possible.

However, there are some edge cases where you might get unexpected errors, so it's best to check out tests for expectations.