kiss_xml 1.0.4

An easy-to-use minimalist schema-less XML parsing library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Example usage tests

/// API usage example
#[test]
fn example3() -> Result<(), kiss_xml::errors::KissXmlError>{
	use kiss_xml;
	use kiss_xml::dom::*;
	// make a DOM from scratch
	let mut doc = Document::new(Element::new_from_name("politicians").unwrap());
	doc.root_element_mut().append(Element::new_with_text("person", "Hillary Clinton").unwrap());
	doc.root_element_mut().append(Element::new_with_text("person", "Bob Dole").unwrap());
	// print to terminal
	println!("{}", doc.root_element());
	// write to file
	doc.write_to_filepath("politics.xml")?;
	Ok(())
}