DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dbf.newDocumentBuilder();
Document doc = builder.newDocument();
Html html = new Html(doc);
Element body = html.getBody();
Element p = doc.createElement("p");
p.setAttribute("style", "font-weight:bold");
p.setTextContent("Hi1");
Element p2 = doc.createElement("p");
p2.setAttribute("style", "font-weight:bold");
p2.setTextContent("Hi2");
body.appendChild(p);
body.appendChild(p2);
String xml = marshal(html);
String htmlString = html.getContent();
Assert.assertEquals(htmlString, "<p style=\"font-weight:bold\">Hi1</p><p style=\"font-weight:bold\">Hi2</p>");
Assert.assertEquals(xml, "<html xmlns=\"http://jabber.org/protocol/xhtml-im\"><body xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"font-weight:bold\">Hi1</p><p style=\"font-weight:bold\">Hi2</p></body></html>");
}