[32286] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3553 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 27 18:09:39 2011

Date: Sun, 27 Nov 2011 15:09:03 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 27 Nov 2011     Volume: 11 Number: 3553

Today's topics:
    Re: XML::XPath Question <elwood@agouros.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 27 Nov 2011 08:41:08 +0000 (UTC)
From: Konstantinos Agouros <elwood@agouros.de>
Subject: Re: XML::XPath Question
Message-Id: <1322383289.608811@rumba>

In <_oOdnVtxo4RyUE3TnZ2dnUVZ7qGdnZ2d@bt.com> Ben Morrow <ben@morrow.me.uk> writes:


>Quoth Konstantinos Agouros <elwood@agouros.de>:
>> 
>> I would like to do a relative search on a subtree.
>> 
>> Say I got a NodeCollection doing something like:
>> 
>> $list = $xmlpath->find("/a/b")
>> 
>> Now I iterate about all instances of <b> in the document and for each one
>> I want to find the c's that have attribute foo.
>> 
>> so I do a foreach my $bar ($list->get_nodelist)
>> {
>> ...
>> }
>> 
>> can I do a $bar->find("c[@foo]") or how can I do this relative to the
>                        ^  ^ 
>                        careful...
>> subtree of each b?

>You want

>    my $clist = $xmlpath->find('./c[@foo]', $bar);

>or './/c[@foo]' if you want indirect as well as direct descendents.
Thanks!

Konstantin

-- 
Dipl-Inf. Konstantin Agouros aka Elwood Blues. Internet: elwood@agouros.de
Altersheimerstr. 1, 81545 Muenchen, Germany. Tel +49 89 69370185
----------------------------------------------------------------------------
"Captain, this ship will not survive the forming of the cosmos." B'Elana Torres


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 3553
***************************************


home help back first fref pref prev next nref lref last post