Tabnine Logo
Jerry$JerryParser.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
jodd.jerry.Jerry$JerryParser
constructor

Best Java code snippets using jodd.jerry.Jerry$JerryParser.<init> (Showing top 14 results out of 315)

origin: oblac/jodd

  @Test
  void testStuck() throws IOException {
    File file = new File(testDataRoot, "stuck.html.gz");
    InputStream in = new GZIPInputStream(new FileInputStream(file));
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    StreamUtil.copy(in, out);
    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(($this, index) -> {
        assertEquals("Go to Database Directory", $this.html().trim());
        return false;
      });
    } catch (StackOverflowError stackOverflowError) {
      fail("stack overflow!");
    }
  }
}
origin: oblac/jodd

@Test
void testNamespaces() throws IOException {
  File file = new File(testDataRoot, "namespace.xml");
  LagartoDOMBuilder lagartoDOMBuilder = new LagartoDOMBuilder();
  lagartoDOMBuilder.enableXmlMode();
  lagartoDOMBuilder.getConfig().setCalculatePosition(true);
  Document doc = lagartoDOMBuilder.parse(FileUtil.readString(file));
  assertTrue(doc.check());
  Element cfgTestElement = (Element) doc.getChild(1);
  assertEquals("cfg:test", cfgTestElement.getNodeName());
  Element cfgNode = (Element) cfgTestElement.getChild(0);
  assertEquals("cfg:node", cfgNode.getNodeName());
  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(($this, index) -> {
    result.append($this.$("cfg\\:node").text());
    return true;
  });
  assertEquals("This is a text", result.toString());
}
origin: oblac/jodd

@Test
void testAbstractFormController() throws IOException {
  File file = new File(testDataRoot, "AbstractFormController.html");
  String content = FileUtil.readString(file);
  Jerry.JerryParser jerryParser = new Jerry.JerryParser();
  //jerryParser.getDOMBuilder().setCalculatePosition(true);
  Jerry doc = jerryParser.parse(content);
  // parse
  doc.$("a").each(($this, index) -> {
    assertEquals("<a name=\"navbar_top\"><!-- --></a>", $this.get()[0].getHtml());
    return false;
  });
}
origin: fivesmallq/web-data-extractor

/**
 * Just creates new {@link JerryParser Jerry runner} to separate
 * parser creation and creation of new Jerry instances.
 */
public static JerryParser jerry() {
  return new JerryParser();
}
origin: fivesmallq/web-data-extractor

/**
 * Creates new {@link JerryParser Jerry runner} with
 * provided implementation of {@link DOMBuilder}.
 */
public static JerryParser jerry(DOMBuilder domBuilder) {
  return new JerryParser(domBuilder);
}
origin: org.jodd/jodd-lagarto

/**
 * Creates new {@link jodd.jerry.Jerry.JerryParser Jerry runner} with
 * provided implementation of {@link jodd.lagarto.dom.DOMBuilder}.
 */
public static JerryParser jerry(final DOMBuilder domBuilder) {
  return new JerryParser(domBuilder);
}
origin: org.jodd/jodd-lagarto

/**
 * Just creates new {@link jodd.jerry.Jerry.JerryParser Jerry runner} to separate
 * parser creation and creation of new Jerry instances.
 */
public static JerryParser jerry() {
  return new JerryParser();
}
origin: oblac/jodd

  @Test
  void testConditionalTags3() {
    Jerry.JerryParser jerry = new Jerry.JerryParser();
    ((LagartoDOMBuilder) jerry.getDOMBuilder()).getConfig()
        .setIgnoreComments(true)
        .setEnableConditionalComments(true)
        .setCondCommentIEVersion(10);

    Jerry doc = jerry.parse(
        "<html>" +
            "    <!--[if lt IE 7]>  <body class=\"ie ie6 ie_lte_9 ie_lte_8 ie_lte_7\"> <![endif]-->\n" +
            "    <!--[if IE 7]>     <body class=\"ie ie7 ie_lte_9 ie_lte_8 ie_lte_7\"> <![endif]-->\n" +
            "    <!--[if IE 8]>     <body class=\"ie ie8 ie_lte_9 ie_lte_8\">      <![endif]-->\n" +
            "    <!--[if IE 9]>     <body class=\"ie ie9 ie_lte_9\">           <![endif]-->\n" +
            "    <!--[if gt IE 9]>  <body class=\"ie\">                    <![endif]-->\n" +
            "    <!--[if !IE]><!--> <body> <!--<![endif]--> \n" +
            "</body></html>"
    );
    String html = doc.html();
    html = StringUtil.removeChars(html, " \n\r");

    assertEquals("<html><bodyclass=\"ie\"></body></html>", html);
  }
}
origin: oblac/jodd

@Test
void testConditionalTags() {
  Jerry.JerryParser jerry = new Jerry.JerryParser();
  ((LagartoDOMBuilder) jerry.getDOMBuilder()).getConfig().setIgnoreComments(true);
  Jerry doc = jerry.parse(
      "<html>" +
          "    <!--[if lt IE 7]>  <body class=\"ie ie6 ie_lte_9 ie_lte_8 ie_lte_7\"> <![endif]-->\n" +
          "    <!--[if IE 7]>     <body class=\"ie ie7 ie_lte_9 ie_lte_8 ie_lte_7\"> <![endif]-->\n" +
          "    <!--[if IE 8]>     <body class=\"ie ie8 ie_lte_9 ie_lte_8\">  <![endif]-->\n" +
          "    <!--[if IE 9]>     <body class=\"ie ie9 ie_lte_9\">           <![endif]-->\n" +
          "    <!--[if gt IE 9]>  <body class=\"ie\">                        <![endif]-->\n" +
          "    <!--[if !IE]>xxx--><body><!--<![endif]-->\n" +
          "</body></html>"
  );
  String html = doc.html();
  html = StringUtil.removeChars(html, " \n\r");
  assertEquals("<html><body></body></html>", html);
}
origin: oblac/jodd

@Test
void testConditionalTags2() {
  Jerry.JerryParser jerry = new Jerry.JerryParser();
  ((LagartoDOMBuilder) jerry.getDOMBuilder()).getConfig()
      .setIgnoreComments(true)
      .setEnableConditionalComments(true)
      .setCondCommentIEVersion(8);
  Jerry doc = jerry.parse(
      "<html>" +
          "    <!--[if lt IE 7]>  <body class=\"ie ie6 ie_lte_9 ie_lte_8 ie_lte_7\"> <![endif]-->\n" +
          "    <!--[if IE 7]>     <body class=\"ie ie7 ie_lte_9 ie_lte_8 ie_lte_7\"> <![endif]-->\n" +
          "    <!--[if IE 8]>     <body class=\"ie ie8 ie_lte_9 ie_lte_8\">  <![endif]-->\n" +
          "    <!--[if IE 9]>     <body class=\"ie ie9 ie_lte_9\">           <![endif]-->\n" +
          "    <!--[if gt IE 9]>  <body class=\"ie\">                        <![endif]-->\n" +
          "    <!--[if !IE]>xxx--><body><!--<![endif]-->\n" +
          "</body></html>"
  );
  String html = doc.html();
  html = StringUtil.removeChars(html, " \n\r");
  assertEquals("<html><bodyclass=\"ieie8ie_lte_9ie_lte_8\"></body></html>", html);
}
origin: oblac/jodd

@Test
void testPortletUtils() throws IOException {
  File file = new File(testDataRoot, "PortletUtils.html");
  String content = FileUtil.readString(file);
  Jerry.JerryParser jerryParser = new Jerry.JerryParser();
  //jerryParser.getDOMBuilder().setCalculatePosition(true);
  Jerry doc = jerryParser.parse(content);
  // parse
  doc.$("a").each(($this, index) -> {
    assertEquals("<a name=\"navbar_top\"><!-- --></a>", $this.get()[0].getHtml());
    return false;
  });
}
origin: oblac/jodd

/**
 * Creates new {@link jodd.jerry.Jerry.JerryParser Jerry runner} with
 * provided implementation of {@link jodd.lagarto.dom.DOMBuilder}.
 */
public static JerryParser jerry(final DOMBuilder domBuilder) {
  return new JerryParser(domBuilder);
}
origin: oblac/jodd

@Test
void testPreserveCC() throws IOException {
  File file = new File(testDataRoot, "preserve-cc.html");
  String expectedResult = FileUtil.readString(file);
  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);
}
origin: oblac/jodd

/**
 * Just creates new {@link jodd.jerry.Jerry.JerryParser Jerry runner} to separate
 * parser creation and creation of new Jerry instances.
 */
public static JerryParser jerry() {
  return new JerryParser();
}
jodd.jerryJerry$JerryParser<init>

Popular methods of Jerry$JerryParser

  • parse
    Invokes parsing on DOMBuilder.
  • getDOMBuilder
  • enableHtmlMode
  • enableXmlMode

Popular in Java

  • Updating database using SQL prepared statement
  • getContentResolver (Context)
  • getApplicationContext (Context)
  • onRequestPermissionsResult (Fragment)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • JLabel (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now