in reply to Re: Copy portion of XML elements from one XML file to another exiting XML file
in thread Copy portion of XML elements from one XML file to another exiting XML file
Hi Corion - Sorry for confusing you, Here is my complete function GetMappletList() i am trying to call,but i am calling it from same script in which the function was declared, The variable $SourceTableName used in the if condition is using values from global variable declared in the script.I am trying to copy portion of xml elements from the source file $MappletXmlName to another file $OutFileName which too have some elements.
sub GetMappletList { my ($TableNm,$ColumnNm,$DomainNm,$AlgoNm); my @MaskingAlgorithmList; my @MappletNode; my $MpltRefFile_Dir = shift; my $MappletXmlName; open GET_MAPPLET_LIST, "<","$Profiler_Dir/$MpltRefFile_Dir/Inve +ntory.rpt" or die "ERROR : Couldn't Open $Profiler_Dir/$MpltRefFile_D +ir/Inventory.rpt $!"; while (my $InvtoryCol = <GET_MAPPLET_LIST> ) { chomp $InvtoryCol; ($TableNm,$ColumnNm,$DomainNm,$AlgoNm) = split(/ +,/,$InvtoryCol); if ($TableNm =~ /$SourceTableName/) { $MappletXmlName = "$Mapplet_Dir/$AlgoNm. +XML"; my $MpltParser = XML::LibXML->new(); my $MpltXml = $MpltParser->parse_file("$ +MappletXmlName"); my $TargetXml = $MpltParser->parse_file( +"$OutFileName"); my @MappletNode = $MpltXml->findnodes('/ +POWERMART/REPOSITORY/FOLDER/MAPPLET'); for my $node (@MappletNode) { $TargetXml->appendChild +($node); #print $node->toString( +2); } } } close(GET_MAPPLET_LIST); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Copy portion of XML elements from one XML file to another exiting XML file
by Corion (Patriarch) on Jan 25, 2014 at 15:14 UTC | |
by Dravidan (Novice) on Jan 25, 2014 at 19:55 UTC | |
by Corion (Patriarch) on Jan 25, 2014 at 20:01 UTC | |
by Dravidan (Novice) on Jan 25, 2014 at 23:02 UTC | |
by Corion (Patriarch) on Jan 26, 2014 at 07:27 UTC |