How do I get the fields ID, NAME, DESCRIPTION. Below is my current code put I can't get beyond the first_child of the file.
use strict;
use warnings;
use XML::Simple;
use Data:umper;
use XML::Twig;
my $t=XML::Twig->new(twig_handlers => {DATA_RECORD => \&dr});
$t->parsefile('C:\\Documents and Settings\fmall\\Desktop\\garth.xml');
sub dr {
my ($t, $dr) = @_;
print $dr->first_child('ID')->text,"\n";
print $dr->first_child('NAME')->text, "\n";
#print $dr->children('DESCRIPTION')->text(), "\n";
print $dr->sibling(1,'DETAILS')->text, "\n";
# print $item->first_child('DESCRIPTION')->text(),"\n";
print "\n";
}
<main>
<DATA_RECORD>
<ID>637</ID>
<NAME>flewatchr_ntfymmscap_up_asuser</NAME>
<FOLDERID>1054</FOLDERID>
<MODIFIED>11/8/2007 5:59:51 PM</MODIFIED>
<DETAILS>
<DEPENDENCY_FILE NAME="flewatchr_ntfymmscap_up_asuser" UID="4CD4ED0C22D5">
<AGENT AGENTTYPE="REMOTE" LOGIC="" UID="C9004C97163C"/>
<DESCRIPTION>I NEED THIS INFO</DESCRIPTION>
<ATTRIBUTES>
<WATCH_SIZE>YES</WATCH_SIZE>
<VALUE>60</VALUE>
<OPERATION>STABLE</OPERATION>
<SOURCE_PATH>\\fs06\sys\misdata\xfer\backup\ntfmmsup[SYSTEM.VARIABLE.day_number].txt</SOURCE_PATH>
</ATTRIBUTES>
</DEPENDENCY_FILE>
</DETAILS>
</DATA_RECORD>
</main>
use strict;
use warnings;
use XML::Simple;
use Data:umper;
use XML::Twig;
my $t=XML::Twig->new(twig_handlers => {DATA_RECORD => \&dr});
$t->parsefile('C:\\Documents and Settings\fmall\\Desktop\\garth.xml');
sub dr {
my ($t, $dr) = @_;
print $dr->first_child('ID')->text,"\n";
print $dr->first_child('NAME')->text, "\n";
#print $dr->children('DESCRIPTION')->text(), "\n";
print $dr->sibling(1,'DETAILS')->text, "\n";
# print $item->first_child('DESCRIPTION')->text(),"\n";
print "\n";
}
<main>
<DATA_RECORD>
<ID>637</ID>
<NAME>flewatchr_ntfymmscap_up_asuser</NAME>
<FOLDERID>1054</FOLDERID>
<MODIFIED>11/8/2007 5:59:51 PM</MODIFIED>
<DETAILS>
<DEPENDENCY_FILE NAME="flewatchr_ntfymmscap_up_asuser" UID="4CD4ED0C22D5">
<AGENT AGENTTYPE="REMOTE" LOGIC="" UID="C9004C97163C"/>
<DESCRIPTION>I NEED THIS INFO</DESCRIPTION>
<ATTRIBUTES>
<WATCH_SIZE>YES</WATCH_SIZE>
<VALUE>60</VALUE>
<OPERATION>STABLE</OPERATION>
<SOURCE_PATH>\\fs06\sys\misdata\xfer\backup\ntfmmsup[SYSTEM.VARIABLE.day_number].txt</SOURCE_PATH>
</ATTRIBUTES>
</DEPENDENCY_FILE>
</DETAILS>
</DATA_RECORD>
</main>