> Sent: Saturday, September 03, 2016 at 2:56 AM > From: stepharo <steph...@free.fr> > To: pharo-users@lists.pharo.org > Subject: Re: [Pharo-users] Coding XPath as Smalltalk > > > > Le 3/9/16 à 08:41, monty a écrit : > >> Sent: Saturday, September 03, 2016 at 2:02 AM > >> From: stepharo <steph...@free.fr> > >> To: "Any question about pharo is welcome" <pharo-users@lists.pharo.org> > >> Subject: Re: [Pharo-users] Coding XPath as Smalltalk > >> > >> Hi monty > >> > >> In which repository this maintained version is? > > PharoExtras/XPath (you gave me the write access). > > Excellent. > I like the idea that we all share an improve common identifiable places.
Yes, I also moved XMLParserHTML and XMLParserStAX from PharoExtras/XMLParser to separate PharoExtras repos. PharoExtras could be the place for community-maintained standard libs. > > > > > >> PharoExtras? > >> > >> Is it the entry in the catalog? > > It has a catalog entry at http://catalog.pharo.org and a CI job at > > https://ci.inria.fr/pharo-contribution/job/XPath/ > > super cool! > I'm happy > > > > >> Stef > >> > >> > >> > >> Le 3/9/16 à 07:54, monty a écrit : > >>> Peter, you're using an ancient version with bugs that were fixed last > >>> fall. The newest version has more tests and correct behavior (checked > >>> against a reference implementation). Just download a new Moose image and > >>> you'll get it, along with an up to date XMLParser. (But if you insist on > >>> upgrading in your old image, run "XPath initialize" after) > >>> > >>> The binary syntax (there are keyword equivalents now) officially only > >>> supports XPath axis selectors like #/ and #// that take node test > >>> arguments where the node tests can be name tests like 'name,' '*', > >>> 'prefix:*' or type tests like 'text()', 'comment()', 'element(name)'. > >>> > >>> Filters aren't officially supported with that syntax, but you can always > >>> use select: on the result. ?? was removed, but I might add it back as > >>> shorthand. Filters are implemented differently now. > >>> > >>>> From: PBKResearch <pe...@pbkresearch.co.uk> > >>>> To: pharo-users@lists.pharo.org > >>>> Subject: [Pharo-users] Coding XPath as Smalltalk > >>>> > >>>> Hello > >>>> > >>>> I am using XPath as a way of dissecting web pages, especially from > >>>> Wiktionary. Generally I get good results, but I could get useful extra > >>>> flexibility by using the binary Smalltalk operators to represent XPath, > >>>> as mentioned at the end of the class comment for XPath. However, the > >>>> description there is very terse, and I am having difficulty seeing how > >>>> to include more complex expressions, especially attribute tests. I have > >>>> put some of my XPath expressions through the XPath compiler and looked > >>>> at the output, and out of that I have found expressions which work but > >>>> look very clumsy. As an example, I have used the fragment: > >>>> > >>>> document xPath: '//div[@id=''catlinks'']//li//text()' > >>>> > >>>> and found that an equivalent is: > >>>> > >>>> document //'div' ?? [:node :x :y|(node attributeAt: 'id') = > >>>> 'catlinks']//'li'//[:n| n isStringNode]]. > >>>> (I had to put two dummy arguments in the three-argument block to get it > >>>> to work.) > >>>> > >>>> Is there a more extensive explanation of the use of these binary > >>>> operators? If not, could some kind person show me the most concise > >>>> translation of the sample XPath above, to give me a start in working out > >>>> more complex cases? > >>>> > >>>> Many thanks for any help. > >>>> > >>>> Peter Kenny > >> > >> > > > > >