toadi has asked for the wisdom of the Perl Monks concerning the following question:
What do I want to do? First I want to say I tried several things some so silly I don't dare to post :)foreach (@node) { &traverse($_); } sub traverse { my($node)= @_; if ($node->getType == XML_ELEMENT_NODE) { print "<", $node->getName, ">"; foreach my $child ($node->childNodes()) { &traverse($child); } print "</", $node->getName, ">"; } elsif ($node->getType() == XML_TEXT_NODE) { print $node->getData; } }
Edit Masem 2001-07-31 - Title change from "Code Logic"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Code Logic
by Tyke (Pilgrim) on Jul 26, 2001 at 18:02 UTC | |
|
Re: Code Logic
by Hofmator (Curate) on Jul 26, 2001 at 18:10 UTC | |
|
Re: Code Logic
by abstracts (Hermit) on Jul 26, 2001 at 18:23 UTC | |
|
Re: Code Logic
by traveler (Parson) on Jul 26, 2001 at 21:21 UTC | |
by toadi (Chaplain) on Jul 26, 2001 at 21:32 UTC | |
by abstracts (Hermit) on Jul 30, 2001 at 16:38 UTC |