Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Stefano Zacchiroli <zack@u...>
Subject: Re: [Caml-list] xpath or alternatives
On Mon, Sep 28, 2009 at 01:17:45PM +0100, Richard Jones wrote:
> I need to do some relatively simple extraction of fields from an XML
> document.  In Perl I would use xpath, very specifically if $xml was an
> XML document[1] stored as a string, then:
> 
>     my $p = XML::XPath->new (xml => $xml);
>     my @disks = $p->findnodes ('//devices/disk/source/@dev');
>     push (@disks, $p->findnodes ('//devices/disk/source/@file'));

I've just realized that this thread can look a bit ridiculous, at least
for people used to other languages where XPath implementations can even
be found in the language standard library (the best solutions we have
thus far are: a 40-line xml-light solution, the need to use a modified
version of the OCaml compiler [yes, I know, it is compatible, but still
...], Galax with unreachable homepage, ...).

So, I was wondering, has anybody ever tried to develop an XPath
implementation on top of, say, PXP? The original announcement page of
PXP (now archived) mentions "rumors" about people which, back then, were
developing it. Has anything ever been released?

At first glance, it doesn't seem to exist any specific typing problem,
at least with XPath 1.0, since the PXP node interface is already common
for all node types. Sure XPath 2.0, when static typing is in use, can be
better integrated with the language, but that's probably already
happening in Galax.

[ Cc-ing the PXP mailing list ]

Cheers.

-- 
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