NYCPHP Meetup

NYPHP.org

[nycphp-talk] XPath Assistance

Matt Kaufman mkfmncom at gmail.com
Fri Oct 14 08:33:08 EDT 2011


Yes,

Ruby Gems: Nokigiri, Hpricot (my preferred), Mqchanize

PHP: Snoopy, few others now... 

Any DOM document processor.

----

If you need it dynamic or on a network service; utilize an ICAP server through a proxy to apply the transformations invisibly.  GreasySpoon is a very great project and is used commonly with Squid, very easy to setup and great admin UI to manage your page modification ( or req or res); and a lot more

...

Matt Kaufman
1-503-887-6906

Sent from my iPhone

On Oct 14, 2011, at 4:55 AM, Joseph Crawford <codebowl at gmail.com> wrote:

> Hello Everyone,
> 
> I have recently been working with XPath and have a document setup like the code below
> 
> <div id='content>
> <h3>Content</h3>
> <div class='log-entry'>Content</div>
> <div class='log-entry'>Content</div>
> <div class='log-entry'>Content</div>
> <h3>Content</h3>
> <div class='log-entry'>Content</div>
> <h3>Content</h3>
> <div class='log-entry'>Content</div>
> <div class='log-entry'>Content</div>
> <div class='log-entry'>Content</div>
> <div class='log-entry'>Content</div>
> <div class='log-entry'>Content</div>
> </div>
> 
> What I am attempting to accomplish is grab each H3 element and then grab every log-entry class element that immediately follows the H3
> up until the point when another H3 is found.  Basically the same results as JQuery's .nextUntil() function.
> 
> Is this possible to do in XPath?  Would I have to work up some PHP code to replicate JQuery's .nextUntil() function?
> 
> Any assistance would be appreciated.
> 
> Here is my example code: http://codepad.viper-7.com/BOz0Ak
> Note that my current xpath query fetches ALL log-entry's and not solely the siblings of the current h3 tag
> 
> Thanks,
> Joseph Crawford
> _______________________________________________
> New York PHP Users Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> http://www.nyphp.org/Show-Participation



More information about the talk mailing list