Hi,
Is there some solution for supporting XPath queries in Pharo?
Cheers, Doru
Hi Doru,
There is a PetitXPath... not complete (just the functionality I needed). And it relies on PetitXml, not html... but I can be easily adapted.
cheers, Esteban
El 19/12/2011, a las 8:43a.m., Tudor Girba escribió:
Hi,
Is there some solution for supporting XPath queries in Pharo?
Cheers, Doru
-- www.tudorgirba.com
"Every thing has its own flow"
Thanks, Esteban.
I gave it a try, but I cannot seem to make it work (and there are no tests :)).
Here is an example of what I tried: xml := '<root> <topChild/> </root>'. element := PPXmlParser parse: xml. element find: 'root/topChild'
I get an invalid index error in PPXPathIndexFilter>>resolveOn:.
Am I doing something wrong?
Also, wildcards do not seem to be suported by the XPath grammar just yet.
Cheers, Doru
On Mon, Dec 19, 2011 at 12:47 PM, Esteban Lorenzano estebanlm@gmail.com wrote:
Hi Doru,
There is a PetitXPath... not complete (just the functionality I needed). And it relies on PetitXml, not html... but I can be easily adapted.
cheers, Esteban
El 19/12/2011, a las 8:43a.m., Tudor Girba escribió:
Hi,
Is there some solution for supporting XPath queries in Pharo?
Cheers, Doru
-- www.tudorgirba.com
"Every thing has its own flow"
Hi,
El 19/12/2011, a las 9:11a.m., Tudor Girba escribió:
Thanks, Esteban.
I gave it a try, but I cannot seem to make it work (and there are no tests :)).
yes... I know that :( I will add them when I can spare some time... and a couple of examples too :P
Here is an example of what I tried: xml := '<root>
<topChild/> </root>'. element := PPXmlParser parse: xml. element find: 'root/topChild'
there is a "known" issue (known by me :( ): PetitXPath is ignoring "document root element"... this is a stupid error and I will fix it (real reason is that when I coded it, I assumed "first element is always unique, so... let's get rid of it"... and yes I know it was a stupid assumption... but I needed this working really fast or my client would became upset)
So... if you do:
element find: '/topChild'
It should work... good thing is other ppl using this stuff encourages me to make it work as it should be :)
cheers, Esteban
Hi Doru,
as far as I know there is no XPath-support. However, I've recently implemented a package (SimpleXPath) that provides support for XPath location paths (without predicates). A path can be parsed from an XPath string or constructed with ST code as well. I've The downside is that is implemented in VisualWorks. I didn't have the time yet to port it to Pharo, although I'd like to have that port, too. I'd be happy if you're interested in helping with this port.
Regards, Steffen
Am 19.12.2011, 12:43 Uhr, schrieb Tudor Girba tudor@tudorgirba.com:
Hi,
Is there some solution for supporting XPath queries in Pharo?
Cheers, Doru