XPath 1.0 interpreter for mochiweb's html tree See src/test.erl for examples
make
make test
mochiweb_xpath:execute/2
mochiweb_xpath:execute/3
mochiweb_xpath:compile_xpath/1
Tree = mochiweb_html:parse(<<"some html">>),
Results = mochiweb_xpath:execute("/some/xpath", Tree).
mochiweb_xpath_parser:compile_xpath/1
utilize two undocumented functions
in xmerl (xmerl_xpath_parse:parse/1
and xmerl_xpath_scan:tokens/1
).
These functions could change between OTP versions.. I'm using R12B2
- self
- child
- descendant-or-self
- descendant
- parent (only for elements, not
text()/parent::
orattribute::*/parent::
) - following-sibling (same as parent)
- preceding-sibling (same as parent)
- attribute
- last
- position
- count
- concat
- ends-with
- name
- starts-with
- contains
- substring
- sum
- string-length
- not
- indexed access (e.g.
div[last() - 1]
)
- ancestor
- ancestor-or-self
- following
- namespace
- preceding
- id
- local-name
- namespace-uri
- string
- substring-before
- substring-after
- normalize-space
- translate
- boolean
- true
- false
- lang
- number
- sum
- floor
- ceiling
- round
port match_*
from xmerl_xpath for better axes support