ableos_userland/programs/xml_tests/src/main.rs

29 lines
707 B
Rust
Raw Normal View History

2023-03-30 23:25:47 -05:00
// 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<u8> = Vec::new();
xml.generate(&mut writer).unwrap();
println!("{}", String::from_utf8_lossy(&writer));
}