Hi ,
Using TS 6.5 Sol 5.8.
We are working on Search & Replace requirement within DCR.
Using TeamSite::XMLnode to read the DCR for search phrase & then use 'set_inner_xml' to replace the value with the DCR.
Now the problem is whenever any value within VFE field is replaced using 'set_inner_xml' then all the > are converted into GREATER THAN sign ( >) and
< remains as it is. Look the example below.
Old DCR values
[HTML]
r
r
<p>John is a TeamSite Expert</p>
[/HTML]
After Replacing 'John' by 'Chris' using 'set_inner_xml'
[HTML]
r
r
<p>Chris is a TeamSite Expert</p>
[/HTML]
Code Snippet from function parseNode()
[HTML]
$replaced_value = $child->get_inner_xml();
$replaced_value =~ s/$search_phrase/$replacePhrase/ig;
$child->set_inner_xml($replaced_value);
[/HTML]
Complete Function parseNode() for search & repalce
[HTML]
sub parseNodes
{
my ($accessor,$file) =
@_;
my $count;
my $temp = $accessor->get_node();
$temp = $temp->type();
my
@children=();
if($replaceCheck eq "Body")
{
@children = grep { $_->type() ne 'meta_data'} $accessor->get_node_list('*');
}
elsif($replaceCheck eq "Metadata")
{
@children = grep { $_->type() ne 'CDATA'} $accessor->get_node_list('meta_data.*');
}
else
{
@children = grep { $_->type() ne 'CDATA'} $accessor->get_node_list('*');
}
foreach my $child (
@children) {
my $type = $child->type();
my $value = $child->value();
my $replaced_value = "";
$logger->info("Type : $type");
$logger->info("Value : $value");
if (($value ne ""))
{
$count = 0;
foreach my $search_phrase (
@search_phrases) {
if ($value =~ /$search_phrase/i)
{
$replaced_value = $child->get_inner_xml();
$replaced_value =~ s/$search_phrase/$replacePhrase/ig;
$child->set_inner_xml($replaced_value);
}
}
}
if ($child->get_node_list('*')) { parseNodes($child,$file); }
}
}
[/HTML]
parseNode is a recursive function()
Any clue why this is happening. Is there something wrong with get_inner_xml & set_inner_xml functions
Please help its urgent.
Rohit Pathak