use minidom::Element; use error::Error; use ns; pub type Body = String; pub fn parse_body(root: &Element) -> Result
{ // TODO: also support components and servers. if !root.is("body", ns::JABBER_CLIENT) { return Err(Error::ParseError("This is not a body element.")); } for _ in root.children() { return Err(Error::ParseError("Unknown child in body element.")); } Ok(root.text()) } #[cfg(test)] mod tests { use minidom::Element; use error::Error; use body; #[test] fn test_simple() { let elem: Element = "