diff options
author | Valentin Popov <info@valentineus.link> | 2019-01-27 03:08:02 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2019-01-27 03:08:02 +0300 |
commit | afe4062e43fd647a588f94792dfd2b9630fcb2b2 (patch) | |
tree | 91ff596e6722623c14db7845dd7b36299aa89c69 | |
parent | ed9f8387f140f29b34004108ed05990fd25bdcd5 (diff) | |
download | bbb2json-afe4062e43fd647a588f94792dfd2b9630fcb2b2.tar.xz bbb2json-afe4062e43fd647a588f94792dfd2b9630fcb2b2.zip |
Sun, 27 Jan 2019 04:08:02 +0400
Signed-off-by: Valentin Popov <info@valentineus.link>
-rw-r--r-- | src/parser.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/parser.rs b/src/parser.rs index ccc082a..19543e1 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -4,23 +4,21 @@ use std::io::BufReader; extern crate xml; use xml::reader::{EventReader, XmlEvent}; -#[derive(RustcEncodable)] +#[derive(Serialize)] pub struct ParserResult { pub external_id: String, pub meeting_id: String, pub meeting_name: String, } -pub fn parse(content: BufReader<File>) -> ParserResult { - let parser = EventReader::new(content); - +pub fn parser(content: BufReader<File>) -> ParserResult { let mut data = ParserResult { external_id: "".to_string(), meeting_id: "".to_string(), meeting_name: "".to_string(), }; - for element in parser { + for element in EventReader::new(content) { match element { Ok(XmlEvent::StartElement { name: _, |