Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • by dstar (8812) on 2008.08.23 10:44 (#64568)

    It's possible, but I'm not sure how to handle multiple predicates. For the simple case, it looks like this:


    which pulls out all the divs which have a grandchild which is a span with a class of 'storyicons'.

    • You can put multiple predicates on a single path step. Something like /foo[@bar='baz'][@quux='qux'] is completely valid (and logically equivalent to /foo[@bar='baz' and @quux='qux']).

      • ah!

        So in the example above, it would be something like


        (I think)

        • Yes; or alternatively:

          "//div[@class='full' and .//div/div[@class='details']/a[@href='"+href+"']]"

        • Err, wait, no. Where did that .// in your second predicate come from? It would be either



          "//div[@class='full' and div/div[@class='details']/a[@href='"+href+"']]"

          You want those nested DIVs and As as direct child nodes of each other and of the node in question – you’re not looking for that subtree anywhere further down.