Code example for Element

Methods: getOwnerDocument

0
  private void runTest(String tagName, String tagMarkup, String templateMarkup, 
      String expectedResult) throws GadgetException, IOException {
    Element templateDef = parseTemplate(templateMarkup);
    Element tagInstance = parseTemplate(tagMarkup);
     
    templateDef.getOwnerDocument().adoptNode(tagInstance);
    TagHandler tagHandler = 
      new TemplateBasedTagHandler(tagInstance, TEST_NS, tagName);
 
    TagRegistry reg = new CompositeTagRegistry(ImmutableList.of(
        registry,
        new DefaultTagRegistry(ImmutableSet.of(tagHandler))));
         
    DocumentFragment result = processor.processTemplate(templateDef, context, resolver, reg);
    String output = serialize(result);
    assertEquals(expectedResult, output);
  } 
   
  private Element parseTemplate(String markup) throws GadgetException {    
    String content = "<script type=\"text/os-template\" xmlns:foo=\"" + TEST_NS + 
        "\" xmlns:os=\"" + TagHandler.OPENSOCIAL_NAMESPACE + "\">" + markup + "</script>";