Hi,
Is there some solution for supporting XPath queries in Pharo? Cheers, Doru -- www.tudorgirba.com "Every thing has its own flow" |
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 <[hidden email]> 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" >> > > -- 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 |
Thanks. It works now :)
Regarding the wildcard expression (//), is it correct to assume that it does not work for now, or is there some hidden trigger? :) I tried this: xml := '<root> <top> <second/> </top> </root>'. element := PPXmlParser parse: xml. element find: '/top/second'. "--> this works fine" element find: '/top//second'. "--> this does not" Cheers, Doru On Mon, Dec 19, 2011 at 1:38 PM, Esteban Lorenzano <[hidden email]> wrote: > 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 -- www.tudorgirba.com "Every thing has its own flow" |
In reply to this post by Tudor Girba-2
Do you know Pastell ?
http://www.squeaksource.com/Pastell.html http://wiki.squeak.org/squeak/Pastell http://blog.corriga.net/2007/06/pastell-xpath-like-library-for-squeak.html http://astares.blogspot.com/2010/01/pharosqueak-and-xml.html On 19 déc. 11, at 12:43, Tudor Girba wrote: > Hi, > > Is there some solution for supporting XPath queries in Pharo? > > Cheers, > Doru > > -- > www.tudorgirba.com > > "Every thing has its own flow" > |
In reply to this post by Tudor Girba-2
mmm...
this one should work: /top/*/second (this is also valid in xpath, but not usually used... I'll add the wildcard as expected to next version) El 19/12/2011, a las 10:10a.m., Tudor Girba escribió: > Thanks. It works now :) > > Regarding the wildcard expression (//), is it correct to assume that > it does not work for now, or is there some hidden trigger? :) > > I tried this: > xml := '<root> > <top> > <second/> > </top> > </root>'. > element := PPXmlParser parse: xml. > element find: '/top/second'. "--> this works fine" > element find: '/top//second'. "--> this does not" > > Cheers, > Doru > > On Mon, Dec 19, 2011 at 1:38 PM, Esteban Lorenzano <[hidden email]> wrote: >> 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 > > > > -- > www.tudorgirba.com > > "Every thing has its own flow" > |
Hi,
I tried this one, too, but it does not work :) But, just for your information, it is the grammar (not the parser) that fails on this one. Cheers, Doru On Mon, Dec 19, 2011 at 2:15 PM, Esteban Lorenzano <[hidden email]> wrote: > mmm... > this one should work: > > /top/*/second > > (this is also valid in xpath, but not usually used... I'll add the wildcard as expected to next version) > > > El 19/12/2011, a las 10:10a.m., Tudor Girba escribió: > >> Thanks. It works now :) >> >> Regarding the wildcard expression (//), is it correct to assume that >> it does not work for now, or is there some hidden trigger? :) >> >> I tried this: >> xml := '<root> >> <top> >> <second/> >> </top> >> </root>'. >> element := PPXmlParser parse: xml. >> element find: '/top/second'. "--> this works fine" >> element find: '/top//second'. "--> this does not" >> >> Cheers, >> Doru >> >> On Mon, Dec 19, 2011 at 1:38 PM, Esteban Lorenzano <[hidden email]> wrote: >>> 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 >> >> >> >> -- >> www.tudorgirba.com >> >> "Every thing has its own flow" >> > > -- www.tudorgirba.com "Every thing has its own flow" |
In reply to this post by Alain Fischer
Hi Alain,
By mistake I somehow did not see this mail. Thanks for the pointer. I did not know about it. Looking at the repository, there is no license. Of course, this can be just a mistake, but as it stands, it mean it is not open source. Cheers, Doru On Mon, Dec 19, 2011 at 2:15 PM, Alain Fischer <[hidden email]> wrote: > Do you know Pastell ? > http://www.squeaksource.com/Pastell.html > http://wiki.squeak.org/squeak/Pastell > http://blog.corriga.net/2007/06/pastell-xpath-like-library-for-squeak.html > http://astares.blogspot.com/2010/01/pharosqueak-and-xml.html > > > On 19 déc. 11, at 12:43, Tudor Girba wrote: > >> Hi, >> >> Is there some solution for supporting XPath queries in Pharo? >> >> Cheers, >> Doru >> >> -- >> www.tudorgirba.com >> >> "Every thing has its own flow" >> > > -- www.tudorgirba.com "Every thing has its own flow" |
We can ask giovanni because he wrote it.
Doru you can use the ConfigurationOfXMLSupport to load it. Stef On Jan 4, 2012, at 2:33 PM, Tudor Girba wrote: > Hi Alain, > > By mistake I somehow did not see this mail. Thanks for the pointer. I > did not know about it. > > Looking at the repository, there is no license. Of course, this can be > just a mistake, but as it stands, it mean it is not open source. > > Cheers, > Doru > > On Mon, Dec 19, 2011 at 2:15 PM, Alain Fischer > <[hidden email]> wrote: >> Do you know Pastell ? >> http://www.squeaksource.com/Pastell.html >> http://wiki.squeak.org/squeak/Pastell >> http://blog.corriga.net/2007/06/pastell-xpath-like-library-for-squeak.html >> http://astares.blogspot.com/2010/01/pharosqueak-and-xml.html >> >> >> On 19 déc. 11, at 12:43, Tudor Girba wrote: >> >>> Hi, >>> >>> Is there some solution for supporting XPath queries in Pharo? >>> >>> Cheers, >>> Doru >>> >>> -- >>> www.tudorgirba.com >>> >>> "Every thing has its own flow" >>> >> >> > > > > -- > www.tudorgirba.com > > "Every thing has its own flow" > |
Actually, it seems I cannot. Or at least I do not know how.
The problem is that Pastell is not mentioned in any group, and the 'default' group only points to Core. So, how do people load this? Cheers, Doru On Wed, Jan 4, 2012 at 3:02 PM, Stéphane Ducasse <[hidden email]> wrote: > We can ask giovanni because he wrote it. > Doru you can use the ConfigurationOfXMLSupport to load it. > > > Stef > > On Jan 4, 2012, at 2:33 PM, Tudor Girba wrote: > >> Hi Alain, >> >> By mistake I somehow did not see this mail. Thanks for the pointer. I >> did not know about it. >> >> Looking at the repository, there is no license. Of course, this can be >> just a mistake, but as it stands, it mean it is not open source. >> >> Cheers, >> Doru >> >> On Mon, Dec 19, 2011 at 2:15 PM, Alain Fischer >> <[hidden email]> wrote: >>> Do you know Pastell ? >>> http://www.squeaksource.com/Pastell.html >>> http://wiki.squeak.org/squeak/Pastell >>> http://blog.corriga.net/2007/06/pastell-xpath-like-library-for-squeak.html >>> http://astares.blogspot.com/2010/01/pharosqueak-and-xml.html >>> >>> >>> On 19 déc. 11, at 12:43, Tudor Girba wrote: >>> >>>> Hi, >>>> >>>> Is there some solution for supporting XPath queries in Pharo? >>>> >>>> Cheers, >>>> Doru >>>> >>>> -- >>>> www.tudorgirba.com >>>> >>>> "Every thing has its own flow" >>>> >>> >>> >> >> >> >> -- >> www.tudorgirba.com >> >> "Every thing has its own flow" >> > > -- www.tudorgirba.com "Every thing has its own flow" |
Hi Doru, I load ConfigurationOfXMLSupport as usual, then just loaded the single Pastell package. I had some deprecation errors (which I fixed) and a single failing test (which I didn't fix), so I pushed a new version that you can get using Gofer new url: 'http://ss3.gemstone.com/ss/SDL'; package: 'Pastell'; load. Yours, Nick Alexander |
In reply to this post by Tudor Girba-2
There is a XPath package (http://www.squeaksource.com/XPath) which
I've been using for some time. To load it: Gofer new squeaksource: 'XMLSupport'; package: 'ConfigurationOfXMLSupport'; load. (Smalltalk at: #ConfigurationOfXMLSupport) perform: #loadDefault. Gofer new squeaksource: 'XPath'; package: 'XPath'; load. there are some tests too, but in your example it would be used this way: | xml doc | xml := '<root> <topChild/> </root>'. doc := XMLDOMParser on: xml. (XPath for: 'root/topChild') in: doc parseDocument Cheers, Hernán 2011/12/19 Tudor Girba <[hidden email]>: > 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 <[hidden email]> 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" >>> >> >> > > > > -- > www.tudorgirba.com > > "Every thing has its own flow" > |
In reply to this post by Tudor Girba-2
I never tried.
But I could have a look. Stef On Jan 4, 2012, at 4:15 PM, Tudor Girba wrote: > Actually, it seems I cannot. Or at least I do not know how. > > The problem is that Pastell is not mentioned in any group, and the > 'default' group only points to Core. So, how do people load this? > > Cheers, > Doru > > On Wed, Jan 4, 2012 at 3:02 PM, Stéphane Ducasse > <[hidden email]> wrote: >> We can ask giovanni because he wrote it. >> Doru you can use the ConfigurationOfXMLSupport to load it. >> >> >> Stef >> >> On Jan 4, 2012, at 2:33 PM, Tudor Girba wrote: >> >>> Hi Alain, >>> >>> By mistake I somehow did not see this mail. Thanks for the pointer. I >>> did not know about it. >>> >>> Looking at the repository, there is no license. Of course, this can be >>> just a mistake, but as it stands, it mean it is not open source. >>> >>> Cheers, >>> Doru >>> >>> On Mon, Dec 19, 2011 at 2:15 PM, Alain Fischer >>> <[hidden email]> wrote: >>>> Do you know Pastell ? >>>> http://www.squeaksource.com/Pastell.html >>>> http://wiki.squeak.org/squeak/Pastell >>>> http://blog.corriga.net/2007/06/pastell-xpath-like-library-for-squeak.html >>>> http://astares.blogspot.com/2010/01/pharosqueak-and-xml.html >>>> >>>> >>>> On 19 déc. 11, at 12:43, Tudor Girba wrote: >>>> >>>>> Hi, >>>>> >>>>> Is there some solution for supporting XPath queries in Pharo? >>>>> >>>>> Cheers, >>>>> Doru >>>>> >>>>> -- >>>>> www.tudorgirba.com >>>>> >>>>> "Every thing has its own flow" >>>>> >>>> >>>> >>> >>> >>> >>> -- >>> www.tudorgirba.com >>> >>> "Every thing has its own flow" >>> >> >> > > > > -- > www.tudorgirba.com > > "Every thing has its own flow" > |
Free forum by Nabble | Edit this page |