jQuery-like selector capabilities to Jericho HTML Parser
Java HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.settings
deploy-files
src
.classpath
.gitignore
.project
.travis.yml
LICENSE
README.md
pom.xml

README.md

Jericho Selector

Build Status Maven Central

jQuery-like selector for Jericho HTML Parser.

Why

Jericho is a great library for parsing and manipulating HTML. But it lacks selectors.

Yes, we have jsoup that has selectors, but there are differences between the projects.

For instance, Jericho allows you to modify just an excerpt of the HTML (keeping formatting and white spaces), while jsoup rewrite the entire structure. It happens because Jericho regards about each character in the document.

And even if I had not any other reason, I just like options. Let each library shine in their own way. ;)

How

Just add the following dependency:

<dependency>
	<groupId>br.com.starcode.jerichoselector</groupId>
	<artifactId>jericho-selector</artifactId>
	<version>1.0.1-RELEASE</version>
</dependency>

Import the static method $ that is used as the entry point:

import static br.com.starcode.jerichoselector.jerQuery.$;

Then you can query HTML elements just like jQuery:

$(html, "p.my-text")

This method is overloaded several times, so you have a lot of input optionsL. Have a look at the unit test to see complete examples.

Status

  • CSS3 Selector parser library based on W3C Official Specification
  • Element selector implementation using Jericho HTML Parser and the parser from step
    • STATUS: DONE

Roadmap

Get in touch

Please, fell free to tell me if you have any issue, suggestion, contribution, or comment. ;)

Just go to http://luizricardo.org.