Package jodd.jerry

Examples of jodd.jerry.Jerry$JerryParser


    in.close();

    Jerry.JerryParser jerryParser = new Jerry.JerryParser();
//    LagartoDOMBuilder lagartoDOMBuilder = (LagartoDOMBuilder) jerryParser.getDOMBuilder();
//    lagartoDOMBuilder.setParsingErrorLogLevelName("ERROR");
    Jerry doc = jerryParser.parse(out.toString("UTF-8"));

    // parse
    try {
      doc.$("a").each(new JerryFunction() {
        public boolean onNode(Jerry $this, int index) {
          assertEquals("Go to Database Directory", $this.html().trim());
          return false;
        }
      });
View Full Code Here


    assertTrue(document.check());

    // (1564 open DTs + 1564 open DDs) 1 open P
    assertEquals(19, document.getErrors().size());

    Jerry doc = Jerry.jerry(FileUtil.readString(file));
    assertEquals(16, doc.$("td.NavBarCell1").size());
    assertEquals(2, doc.$("table td.NavBarCell1Rev").size());

    assertEquals(1, doc.$("dl").size());
    assertEquals(1564, doc.$("dd").size());
    assertEquals(1564, doc.$("dt").size());
    assertEquals(3144, doc.$("dt a").size());

    // http://docs.oracle.com/javase/6/docs/api/index-files/index-4.html
    file = new File(testDataRoot, "index-4-eng.html");
    doc = Jerry.jerry(FileUtil.readString(file));

    assertEquals(16, doc.$("td.NavBarCell1").size());
    assertEquals(2, doc.$("table td.NavBarCell1Rev").size());

    final StringBuilder sb = new StringBuilder();
    doc.$("td.NavBarCell1").each(new JerryFunction() {
      public boolean onNode(Jerry $this, int index) {
        sb.append("---\n");
        sb.append($this.text().trim());
        sb.append('\n');
        return true;
View Full Code Here

    Jerry.JerryParser jerryParser = new Jerry.JerryParser();

    ((LagartoDOMBuilder) jerryParser.getDOMBuilder()).enableXmlMode();

    Jerry jerry = jerryParser.parse(FileUtil.readString(file));

    final StringBuilder result = new StringBuilder();

    jerry.$("cfg\\:test").each(new JerryFunction() {
      public boolean onNode(Jerry $this, int index) {
        result.append($this.$("cfg\\:node").text());
        return true;
      }
    });
View Full Code Here

    Jerry.JerryParser jerryParser = new Jerry.JerryParser();
    ((LagartoDOMBuilder) jerryParser.getDOMBuilder()).enableHtmlMode();
    ((LagartoDOMBuilder) jerryParser.getDOMBuilder()).getConfig().setEnableConditionalComments(false);

    Jerry jerry = jerryParser.parse(expectedResult);
    String result = jerry.html();

    assertEquals(expectedResult, result);
  }
View Full Code Here

  }

  @Test
  public void testKelkoo() throws Exception {
    File file = new File(testDataRoot, "kelkoo.html");
    Jerry jerry;
    try {
      jerry = Jerry.jerry().parse(FileUtil.readString(file));
    } catch (Exception ex) {
      fail(ex.toString());
      throw ex;
    }

    Element script = (Element) jerry.$("script").get(0);

    assertEquals("script", script.getNodeName());
    assertEquals(6, script.getAttributesCount());

    assertEquals("src", script.getAttribute(0).getName());
View Full Code Here

    String content = FileUtil.readString(file);

    Jerry.JerryParser jerryParser = new Jerry.JerryParser();
    //jerryParser.getDOMBuilder().setCalculatePosition(true);

    Jerry doc = jerryParser.parse(content);

    // parse
    doc.$("a").each(new JerryFunction() {
      public boolean onNode(Jerry $this, int index) {
        assertEquals("<a name=\"navbar_top\"><!-- --></a>", $this.get()[0].getHtml());
        return false;
      }
    });
View Full Code Here

    String content = FileUtil.readString(file);

    Jerry.JerryParser jerryParser = new Jerry.JerryParser();
    //jerryParser.getDOMBuilder().setCalculatePosition(true);

    Jerry doc = jerryParser.parse(content);

    // parse
    doc.$("a").each(new JerryFunction() {
      public boolean onNode(Jerry $this, int index) {
        assertEquals("<a name=\"navbar_top\"><!-- --></a>", $this.get()[0].getHtml());
        return false;
      }
    });
View Full Code Here

TOP

Related Classes of jodd.jerry.Jerry$JerryParser

Copyright © 2018 www.massapicom. 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.