Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: XPATH Looping

by choroba (Abbot)
on Sep 19, 2012 at 23:11 UTC ( #994562=note: print w/ replies, xml ) Need Help??


in reply to XPATH Looping

You are searching for nodes with //. It starts from the top and seraches everywhere. That is not what you want. Start your XPath expressions (except the first one) with .// and add the second argument to find - the context node. The loop variable of the nearest higher loop should be the context node. The loop entrances will look like this:

for my $Transaction835 ($xp->find('//Transaction835')->get_nodelist) { ... for my $ClaimPaymentInformationLoop ($xp->find('.//ClaimPaymentInf +ormationLoop', $Transaction835)->get_nodelist) { ... for my $ServicePaymentInformationLoop ($xp->find('.//ServicePa +ymentInformation', $ClaimPaymentInformationLoop)->get_nodelist) {
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: XPATH Looping
Select or Download Code
Re^2: XPATH Looping
by medirecpr (Novice) on Sep 20, 2012 at 11:43 UTC
    Yes! That was it! Got it to work as expected. Thank you Monk choroba. Will be working on this all day, also update post with latest code. Kindest regards,

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://994562]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2014-09-18 21:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (124 votes), past polls