My requirement is while generating a dcr, I want to open another DCR and add a node to it. The Node would basically be a replicant addition to the existing dcr.for instance,I have a DCR x and I am generating an html x.html from it.while generating the x.html, i also want to open an existing DCR y and add a node to a replicant. The replicant consists of DCR paths and so I want to add the path of DCR x to the DCR y as an item.Please adviseThanksTeamsite 6.5Unix
if($rootxml !~ /$dcrName<\/News Release>/){
Please Help!!!!!I tried the following code but does not work.my $dcr = 'path to dcr';my $xml = "";if ( -e $dcr) { open (DCR,$dcr); while(<DCR>) { $xml .= $_; } close(DCR);}# This condition checks to see if the dcr entry exists in the newsroom dcr and adds it if not presentif ($xml ne '') { my $root = TeamSite:CRnode->new($xml); my $rootxml = $root->get_inner_xml(); my $dcrName = iwpt_get_dcr_name(); #Retrieve the dcr Name $dcrName =~ s|(.*/DEVELOPMENT)||; if($rootxml !~ /<News Release>$dcrName<\/News Release>/){ my $tmp = "<Newsroom><News Release>".$dcrName."</News Release></Newsroom>"; $rootxml =~ s|(<Page Content>)(.*)(</Page Content>)|$1$2$tmp$3|; $root->set_inner_xml($rootxml); } my $mod_dcr = $root->get_dcr(); iwpt_output($mod_dcr);}The $mod_dcr is blank. Please suggest what to do. I have tried many things but none work.Thanks
my $dcr = 'path to dcr';my $xml = "";if ( -e $dcr) { open (DCR,$dcr); while(<DCR>) { $xml .= $_; } close(DCR);}# This condition checks to see if the dcr entry exists in the newsroom dcr and adds it if not presentif ($xml ne '') { my $root = TeamSite:CRnode->new($xml); my $rootxml = $root->get_inner_xml(); my $dcrName = iwpt_get_dcr_name(); #Retrieve the dcr Name $dcrName =~ s|(.*/DEVELOPMENT)||; if($rootxml !~ /<News Release>$dcrName<\/News Release>/){ my $tmp = "<Newsroom><News Release>".$dcrName."</News Release></Newsroom>"; $rootxml =~ s|(<Page Content>)(.*)(</Page Content>)|$1$2$tmp$3|; $root->set_inner_xml($rootxml); } my $mod_dcr = $root->get_dcr(); iwpt_output($mod_dcr);}
Ok I tried all that you suggested to do but still no use. You should consider using a different delimiter for your pattern matching if part of the pattern is going to contain the character ('/') that you're currently using ------ I get an error if I use anything else. so I have to stick with / but in any case the loop gets excecuted. so there is no issue with that pattern matching.
You should consider using a different delimiter for your pattern matching if part of the pattern is going to contain the character ('/') that you're currently using
if ($rootxml !~ /<aaa>bbb<\/aaa>/){ ... }
if ($rootxml !~ m|<aaa>bbb</ccc>|){ ... }
Here is the output of this code if($rootxml !~ /<NewsRelease>$dcrName<\/NewsRelease>/){ my $tmp = "<Newsroom><News Release>".$dcrName."</News Release></Newsroom>"; $rootxml =~ s|(<Newsroom>)(.*)(</Newsroom>)|$1$2$3$tmp|; iwpt_output($rootxml); }
The othput is what it needs to be so no error there either[...]
$dcr