コード例 #1
0
  @Test
  public void testSerializeHtml() throws Exception {
    String markup =
        "<!DOCTYPE html>\n"
            + "<html><head><title>Apache Shindig!</title></head>"
            + "<body>"
            + "<div xmlns:osx=\"http://ns.opensocial.org/2008/extensions\">"
            + "<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);
    }
  }
コード例 #2
0
  @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://ns.opensocial.org/2008/markup\">"
            + "  <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);
    }
  }