// use simple_xml_serialize::XMLElement; // fn main() { // let mut ele = XMLElement::new("mouse"); // println!("{}", ele); // } use xml_builder::{XMLBuilder, XMLElement, XMLVersion}; fn main() { let mut xml = XMLBuilder::new() .version(XMLVersion::XML1_1) .encoding("UTF-8".into()) .build(); let mut mouse = XMLElement::new("mouse"); mouse.add_attribute("x", "8"); mouse.add_attribute("y", "0"); mouse.add_attribute("y_change", "-1"); mouse.add_attribute("x_change", "1"); xml.set_root_element(mouse); let mut writer: Vec = Vec::new(); xml.generate(&mut writer).unwrap(); println!("{}", String::from_utf8_lossy(&writer)); }