I am trying to parse the attributes of an empty node "<link>" which reside in multiple DCRs but can't seem to retrieve the values. Following is the structure of the DCR file.
<?xml version="1.0" encoding="UTF-8" ?>
<Data>
<Page2>
<Links_and_Attachments>
<Article_Links>
<Related_Content_Links>
<Related_Content_Link>
<link Type = 'Article' linkValue = '28'/>
</Related_Content_Link>
</Related_Content_Links>
<Related_Content_Links>
<Related_Content_Link>
<link Type = 'Article' linkValue = '34'/>
</Related_Content_Link>
</Related_Content_Links>
<Related_Content_Links>
<Related_Content_Link>
<link Type = 'Article' linkValue = '33'/>
</Related_Content_Link>
</Related_Content_Links>
</Article_Links>
</Links_and_Attachments>
</Page2>
</Data>
Following is the code snippet:
foreach my $dcrPath (
@dcr_Path){
my $dcr = $dcrPath;
my $xml = '';
if (open(IN, "<$dcr"))
{
local $/;
$xml = <IN>;
close(IN);
}
my $rootnode = TeamSite::XMLnode->new($xml);
my
@list = $rootnode->get_node_list('Page2.Links_and_Attachments.Article_Links.Related_Content_Links');
foreach my $node (
@list) {
my
@myNodes = $node->get_node_list('Related_Content_Link.link');
foreach my $subnode(
@myNodes) {
print "type: ",$subnode->get_attrib('Type'),"\n";
print "linkvalue: ",$subnode->get_attrib('linkValue'),"\n\n";
}
}
}
Edited by sabih on 01/11/05 12:14 PM (server time).