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 <tu...@tudorgirba.com>:
> 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 <esteba...@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"
>>>
>>
>>
>
>
>
> --
> www.tudorgirba.com
>
> "Every thing has its own flow"
>

Reply via email to