jquery selectors for HTML & XML in erlang
Erlang Shell
Latest commit 8f3bd47 May 5, 2014 @marianoguerra Merge pull request #1 from matehat/master
Make the project rebar-aware
Failed to load latest commit information.
src Delete build.sh as it's not needed anymore when using rebar May 4, 2014
.gitignore add crash dumps to git ignore Jul 10, 2011
README.rst add test instructions Jul 10, 2011
rebar Added rebar executable May 4, 2014
rebar.config Update rebar.config Apr 29, 2014


qrly - a query module for erlang

qrly attempts to be a query module for erlang that provides an API to extract information from structured data using a jquery-like API.

the implementation provides a standard api that allows to extend it to support other languages

supported selectors

for details on selectors check the jquery documentation: http://api.jquery.com/category/selectors/

  • .class
  • #id
  • tagname
  • Attribute Contains Selector [name*="value"]
  • Attribute Contains Word Selector [name~="value"]
  • Attribute Ends With Selector [name$="value"]
  • Attribute Equals Selector [name="value"]
  • Attribute Not Equal Selector [name!="value"]
  • Multiple Attribute Selector [name="value"][name2="value2"]
  • Attribute Starts With Selector [name^="value"]
  • :first
  • :last
  • :odd
  • :even
  • :nth-child(N)
  • :eq(N)
  • :gt(N)
  • :lt(N)
  • Multiple Selector (“selector1, selector2, selectorN”)

other selectors are not implemented because of lack of time in spawnfest, they are really easy to implement (already parsed, but not implemented in qrly:filter) and should come after the spawnfest ends and I have some time to add them.

supported data formats


the qrly_xml provides an api to manipulate and query xml using xmerl as a backend


the qrly_html provides an api to manipulate and query html using mochiweb_html as a backend


use qrly_html:parse or qrly_html:parse_string to load from file or string an html file and convert it to a qrly data structure and then use qrly_html:filter to apply the filtering.

if you want your string back call qrly_html:to_string. if you want to store it on a file call qrly_html:to_file.

the same instructions work for qrly_xml and any other future implementation of the api (imagine querying json structures with this).


1> {ok, Qrly} = qrly_html:parse("../extra/test/test.html").
2> Q1 = qrly_html:filter(Qrly, "h1").
  [{<<"class">>,<<"first-title asdwordclass">>}],
  [{<<"class">>,<<"second-title wordclass">>}],
   {<<"class">>,<<"third-title wordclass">>}],
3> Q2 = qrly_html:filter(Qrly, "h1.first-title").
  [{<<"class">>,<<"first-title asdwordclass">>}],
4> io:format("~s~n", [qrly_html:to_string(Q1)]).
<div><h1 class="first-title asdwordclass">personal</h1><h1 class="second-title wordclass">projects</h1><h1 title="others" class="third-title wordclass">others</h1></div>
5> io:format("~s~n", [qrly_html:to_string(Q2)]).
<div><h1 class="first-title asdwordclass">personal</h1></div>


qrly uses eunit, just do:

cd src

it will compile and run the tests


let me introduce you: Qrly the bird



BSD + optional beer invitation to the creator

see LICENSE for details