🦎
Jodd Lagarto
  • Lagarto HTML parsers suite
  • Installation
  • Contact
  • Lagarto parser
    • LagartoParser
    • Events
    • Configuration
    • Adapter and Writer
    • FAQ
  • Lagarto DOM
    • LagartoDOM
    • Parsing modes
    • Configuration
  • Jerry
    • Jerry
    • Using Jerry
  • CSSelly
    • CSSelly
    • Selectors
    • Customize
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Jerry

Jerry

jQuery in Java

PreviousConfigurationNextUsing Jerry

Last updated 4 years ago

Was this helpful?

Jerry is a in Java - fast and focused Java library that simplifies parsing, traversing and manipulating the HTML content, using the same methods and syntax as the jQuery.

Look, it's really cool:

Jerry doc = Jerry.of("<html><div id='jodd'><b>Hello</b> Jerry</div></html>");
doc.s("div#jodd b").css("color", "red").addClass("ohmy");

The (formatted) output will be:

<html>
    <div id="jodd">
        <b style="color:red;" class="ohmy">Hello</b> Jerry
    </div>
</html>

I tried to keep Jerry API identical to the jQuery as much as possible. In some cases, you can simply copy some jQuery code and paste it in Java - and it will work! Of course, there are some differences due to the different nature of the platforms.

The well-known jQuery method $() is renamed tos() in Jerry. The reason is compatibility with different JVMs: GraalVM, for example, does not allow usage of $ in method names.

If you don't like the s() method, use the find() alternative.

jQuery