mecrazycoder has asked for the wisdom of the Perl Monks concerning the following question:
My goal is to retrieve all the value from XML file excluding tags.It works well.But now i want retrieve values from particular area.Consider the XML file is likesub start { @tempArray=0; #our $filename=shift; our $parser = new XML::DOM::Parser; our $doc = $parser->parsefile("1597976.doc001.out.xml") or die "Un +able to parse document"; our $root = $doc->getDocumentElement(); valueIntoArray($root); } sub valueIntoArray #Placing values alone into array { my ($rt)= @_; foreach my $node ( $rt->getChildNodes()) { if (($node->getNodeType() == TEXT_NODE ) && ($node->getData()= +~ /\S/s)) { #push(@tempArray,lc($node->getData())); print $node->getData()."\n"; } valueIntoArray($node); } #return sort(@tempArray); }
.Here i want to retrieve only values under Education tag.How can i do that.Education tags contain various tags depending upon input.So i cant go by tag name.Please help me<Person> <Address> <name>xxx</name> <mobile>xxx</mobile> </Address> <Education> <Degree>xxx</Degree> <Major>xxx</Major> </Education> </Person>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regarding XML::DOM::Parser
by tmharish (Friar) on Sep 16, 2009 at 15:11 UTC | |
by Jenda (Abbot) on Sep 17, 2009 at 14:18 UTC | |
|
Re: Regarding XML::DOM::Parser
by Jenda (Abbot) on Sep 17, 2009 at 14:23 UTC |