xpath question

Simon Forman rogue_pedro at yahoo.com
Mon Jul 3 13:07:10 EDT 2006


uche.ogbuji at gmail.com wrote:
> bruce wrote:
> > is there anyone with XPath expertise here? i'm trying to figure out if
> > there's a way to use regex expressions with an xpath query? i've seen
> > references to the ability to use regex and xpath/xml, but i'm not sure how
> > to do it...
> >
> > i have a situation where i have something like:
> >  /html/table/..../[@class='foo']
> >
> > is it possible to do soomething like [@class~=/fo/] so i'd match the class
> > attribute with fo....
> >
> > i'm trying to parse HTML/Web docs...
>
> 4Suite [1] supports regex in XPath using the EXSLT community standard's
> regex module [2].  It would be something like:
>
> [re:match(@class, 'fo.*']
>
> With the re prefix set as required by the EXSLT module.
>
> [1] http://4Suite.org
> [2] http://www.exslt.org/regexp/
>
> --
> Uche Ogbuji                               Fourthought, Inc.
> http://uche.ogbuji.net                    http://fourthought.com
> http://copia.ogbuji.net                   http://4Suite.org
> Articles: http://uche.ogbuji.net/tech/publications/

Well shut my mouth!  There *is* an xml/xpath python Guru here.

*sigh*  Sorry Bruce, (and everybody else on this newsgroup) I apologize
for mouthing off and not contributing to a greater signal-to-noise
ratio.

I guess that should teach me not to post so quickly when I'm in a bad
mood.  I'll do better in the future.


Peace,
~Simon




More information about the Python-list mailing list