English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
xpath or alternatives
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-09-30 (15:13)
From: Stefano Zacchiroli <zack@u...>
Subject: Re: [Caml-list] xpath or alternatives
On Wed, Sep 30, 2009 at 04:49:37PM +0200, Gerd Stolpmann wrote:
> No. However, there is a little XPath evaluator in SVN:
> https://godirepo.camlcity.org/svn/lib-pxp/trunk/src/pxp-engine/pxp_xpath.ml

Cool, and you have even already implemented all of the XPath 1.0
standard library!

> I have never found the time to complete it, and to add some syntax
> extension for painless use. But maybe somebody wants to take this
> over?

If I'm not mistaken, more than a syntax extension that evaluator needs a
parser from concrete syntax to the abstract syntax you've already
implemented. Once you have that, I don't think there is really a need of
any syntax extension, what would be wrong in using it as follows:

  let nodes = xpath_eval ~xpath:(xpath "/foo/bar[2]/@baz") tree in
  let nodes2 = xpath_eval ~expr:"/foo/bar[2]/@baz" in

we already use regexps this way and is more than handy. Or am I missing
something here?

I don't have energy to volunteer myself, but I duly note that Alain's
old XPath implementation already contains a parser that can be reused
(whereas the lexer should be changed, as already observed; most likely
the lexer should be ported to Ulex).

All in all, it is probably just a matter of integration work (modulo the
limitations of the current evaluator, of course).

Any volunteer? :-)


Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7
zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
Dietro un grande uomo c'è ..|  .  |. Et ne m'en veux pas si je te tutoie
sempre uno zaino ...........| ..: |.... Je dis tu à tous ceux que j'aime