Examples of XPathWrapper


Examples of org.apache.shindig.gadgets.rewrite.XPathWrapper

    parseSimpleString(nekoParser);
  }

  private void parseSimpleString(GadgetHtmlParser htmlParser) throws Exception {
    Document doc = htmlParser.parseDom("content");
    XPathWrapper wrapper = new XPathWrapper(doc);
    assertEquals("content", wrapper.getValue("/html/body"));
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.rewrite.XPathWrapper

    parseTagWithStringContents(nekoParser);
  }

  void parseTagWithStringContents(GadgetHtmlParser htmlParser) throws Exception {
    Document doc = htmlParser.parseDom("<span>content</span>");
    XPathWrapper wrapper = new XPathWrapper(doc);
    assertEquals("content", wrapper.getValue("/html/body/span"));
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.rewrite.XPathWrapper

    parseTagWithAttributes(nekoParser);
  }

  void parseTagWithAttributes(GadgetHtmlParser htmlParser) throws Exception {
    Document doc = htmlParser.parseDom("<div id=\"foo\">content</div>");
    XPathWrapper wrapper = new XPathWrapper(doc);
    assertEquals("content", wrapper.getValue("/html/body/div"));
    assertEquals("foo", wrapper.getValue("/html/body/div/@id"));
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.rewrite.XPathWrapper

    parseNestedContentWithNoCloseForBrAndHr(nekoParser);
  }                    

  void parseNestedContentWithNoCloseForBrAndHr(GadgetHtmlParser htmlParser) throws Exception {
    Document doc = htmlParser.parseDom("<div>x and y<br> and <hr>z</div>");
    XPathWrapper wrapper = new XPathWrapper(doc);
    assertEquals("x and y and z", wrapper.getValue("/html/body/div"));
    assertEquals(1, wrapper.getNodeList("/html/body/div/br").getLength());
    assertEquals(1, wrapper.getNodeList("/html/body/div/hr").getLength());
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.rewrite.XPathWrapper

    expectSecurityToken();
    EasyMock.expect(gadget.sanitizeOutput()).andReturn(false);
    expectFeatureLookup();
    replay();
    handler.process(result.getDocumentElement().getFirstChild().getNextSibling(), tag, processor);
    XPathWrapper wrapper = new XPathWrapper(result);
    assertEquals(wrapper.getValue("/html/head/script[1]"), "swfobject()");
    assertEquals(wrapper.getValue("/html/body/div/@id"), "os_xFlash_alt_1");
    assertEquals(wrapper.getValue("/html/body/div"), "Click Me");
    assertNull(wrapper.getNode("/html/body/div/@onclick"));
    assertEquals(wrapper.getValue("/html/body/script[1]"),
        "swfobject.embedSWF(\"http://www.example.org/test.swf\",\"os_xFlash_alt_1\",\"100px\","
            + "\"100px\",\"9.0.115\",null,null,{\"flashvars\":\"st=12345\"},{});");
    verify();
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.rewrite.XPathWrapper

    expectSecurityToken();
    EasyMock.expect(gadget.sanitizeOutput()).andReturn(true);
    expectFeatureLookup();
    replay();
    handler.process(result.getDocumentElement().getFirstChild().getNextSibling(), tag, processor);
    XPathWrapper wrapper = new XPathWrapper(result);
    assertEquals(wrapper.getValue("/html/head/script[1]"), "swfobject()");
    assertEquals(wrapper.getValue("/html/body/div/@id"), "os_xFlash_alt_1");
    assertEquals(wrapper.getValue("/html/body/div"), "Click Me");
    assertNull(wrapper.getNode("/html/body/div/@onclick"));
    assertEquals(wrapper.getValue("/html/body/script[1]"),
        "swfobject.embedSWF(\"http://www.example.org/test.swf\",\"os_xFlash_alt_1\",\"100px\","
            + "\"100px\",\"9.0.115\",null,null,{\"swliveconnect\":false,"
            + "\"flashvars\":\"st=12345\",\"allowscriptaccess\":\"never\",\"allownetworking\":\"internal\"},{});");
    verify();
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.rewrite.XPathWrapper

    expectSecurityToken();
    EasyMock.expect(gadget.sanitizeOutput()).andReturn(true);
    expectFeatureLookup();
    replay();
    handler.process(result.getDocumentElement().getFirstChild().getNextSibling(), tag, processor);
    XPathWrapper wrapper = new XPathWrapper(result);
    assertEquals(wrapper.getValue("/html/head/script[1]"), "swfobject()");
    assertEquals(wrapper.getValue("/html/body/div/@id"), "os_xFlash_alt_1");
    assertEquals(wrapper.getValue("/html/body/div"), "Click Me");
    assertEquals(wrapper.getValue("/html/body/div/@onclick"), "os_xFlash_alt_1()");
    assertEquals(wrapper.getValue("/html/body/script[1]"),
        "function os_xFlash_alt_1(){ swfobject.embedSWF(\"http://www.example.org/test.swf\","
            + "\"os_xFlash_alt_1\",\"100px\",\"100px\",\"9.0.115\",null,null,"
            + "{\"swliveconnect\":false,\"flashvars\":\"st=12345\",\"allowscriptaccess\":\"never\",\"allownetworking\":\"internal\"},{}); }");
    verify();
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.rewrite.XPathWrapper

            + "Click Me"
          + "</osx:flash></script>");
    Element tag = DomUtil.getElementsByTagNameCaseInsensitive(document, ImmutableSet.of("osx:flash"))
        .get(0);
    handler.process(result.getDocumentElement().getFirstChild().getNextSibling(), tag, processor);
    XPathWrapper wrapper = new XPathWrapper(result);
    assertTrue(wrapper.getValue("/html/body/span").startsWith("Failed to process os:Flash tag"));
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.rewrite.XPathWrapper

    expectSecurityToken();
    EasyMock.expect(gadget.sanitizeOutput()).andReturn(false);
    expectFeatureLookup();
    replay();
    handler.process(result.getDocumentElement().getFirstChild().getNextSibling(), tag, processor);
    XPathWrapper wrapper = new XPathWrapper(result);
    assertEquals("swfobject()", wrapper.getValue("/html/head/script[1]"));
    assertEquals("os_xFlash_alt_1", wrapper.getValue("/html/body/div/@id"));
    assertEquals("Click Me", wrapper.getValue("/html/body/div"));
    assertNull(wrapper.getNode("/html/body/div/@onclick"));
    assertEquals(wrapper.getValue("/html/body/script[1]"),
        "swfobject.embedSWF(\"http://www.example.org/test.swf\",\"os_xFlash_alt_1\",\"100px\","
            + "\"100px\",\"9.0.115\",null,null,{\"flashvars\":\"st=12345\"},{});");
    verify();
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.rewrite.XPathWrapper

    expectSecurityToken();
    EasyMock.expect(gadget.sanitizeOutput()).andReturn(true);
    expectFeatureLookup();
    replay();
    handler.process(result.getDocumentElement().getFirstChild().getNextSibling(), tag, processor);
    XPathWrapper wrapper = new XPathWrapper(result);
    assertEquals("swfobject()", wrapper.getValue("/html/head/script[1]"));
    assertEquals("os_xFlash_alt_1", wrapper.getValue("/html/body/div/@id"));
    assertEquals("Click Me", wrapper.getValue("/html/body/div"));
    assertNull(wrapper.getNode("/html/body/div/@onclick"));
    assertEquals(wrapper.getValue("/html/body/script[1]"),
        "swfobject.embedSWF(\"http://www.example.org/test.swf\",\"os_xFlash_alt_1\",\"100px\","
            + "\"100px\",\"9.0.115\",null,null,{\"swliveconnect\":false,"
            + "\"flashvars\":\"st=12345\",\"allowscriptaccess\":\"never\",\"allownetworking\":\"internal\"},{});");
    verify();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.