|
|
| Perl-Sensitive Sunglasses | |
| PerlMonks |
nodelists and nodesetsby nonnonymousnonk (Novice) |
| on Nov 22, 2007 at 15:41 UTC ( [id://652397]=perlquestion: print w/replies, xml ) | Need Help?? |
|
nonnonymousnonk has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks, XML::xpath is making my brain ache, perhaps someone can enlighten me. It's taken a while but I think I'm starting to understand the differences between a nodeset and a node list. I'm sure I've not got it fully because my code so far is not that nice.
What I'm doing is getting a nodeset using find(), for example:
I then run though the nodes like this
Most of the time I'm just getting attributes as in the above code and chucking them out to an Excel spreadsheet but for a few values of $devicetype I need to dig deeper into the XML and this is where I'm stuck.
What I've done is go back to the beginning like this:
I'm doing this because $device is a node from a node list not from a nodeset so I can't do this:
If I go into the debugger and look at $plantdata->{nodeset} and $device both seem to contain a hell of a lot more than just the node I want. Is there a way to turn a $device node back into a nodeset so that I can dig deeper into it rather than going back to $xp and starting again?
Thanks
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||