### Question:
HtmlSerialization { public static String serialize(Document doc) { return ((HtmlSerializer) doc.getUserData(KEY)).serialize(doc); }  static void attach(Document doc, HtmlSerializer serializer, String originalContent); static StringWriter createWriter(Document doc); static String serialize(Document doc); static void printEscapedText(CharSequence text, Appendable output); static void printStartElement(Element elem, Appendable output, boolean withXmlClose); static void printStartElement(String tagName, NamedNodeMap attributes, Appendable output,
       boolean withXmlClose); static void outputDocType(DocumentType docType, Appendable output); static boolean isUrlAttribute(QName name, String attributeName); static final String KEY; static final Set<String> URL_ATTRIBUTES; }### Answer:
@Test @Ignore("Caja parses OS script tags but does not serialize them to their original form") public void testSerialize() throws Exception { String markup = "<!DOCTYPE html>\n" + "<html><head><title>Apache Shindig!</title></head>" + "<body>" + "<script type=\"text/os-data\" xmlns:os=\"http: + " <os:PeopleRequest groupId=\"@friends\" key=\"friends\" userId=\"@viewer\"></os:PeopleRequest>\n" + "</script>" + "<script require=\"friends\" type=\"text/os-template\">\n" + " <ul><li repeat=\"${friends}\">\n" + " <span id=\"id${Context.Index}\">${Cur.name.givenName}</span>\n" + " </li></ul>" + "</script>" + "</body></html>"; for(GadgetHtmlParser parser : parsers) { Document doc = parser.parseDom(markup); String result = HtmlSerialization.serialize(doc); assertEquals(markup, result); } }
@Test public void testSerializeHtml() throws Exception { String markup = "<!DOCTYPE html>\n" + "<html><head><title>Apache Shindig!</title></head>" + "<body>" + "<div xmlns:osx=\"http: + "<osx:NavigateToApp>\n" + "<img border=\"0\" src=\"foo.gif\">\n" + "</osx:NavigateToApp>\n" + "</div>" + "</body></html>"; for(GadgetHtmlParser parser : parsers) { Document doc = parser.parseDom(markup); String result = HtmlSerialization.serialize(doc); assertEquals(markup, result); } }