Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
parse DCR and add or modify a node value
carletto
HI
is it possible during generate or regenerate process add or modify a node value of DCR file?
Find more posts tagged with
Comments
Adam Stoller
Is it possible - yes, is it reasonable to do so - unclear?
The PT can call arbitrary programs and/or Perl code to do all sorts of things, one of which could be to go and modify the contents of a DCR - but I think you'd have to provide a good use-case scenario fo why you'd need to do this before implementing it because there are a number of factors that make this less than a "safe" or trivial thing to do.
--fish
(Interwoven Senior Technical Consultant)
carletto
HI,
It's very simple use-case.
Contributor fills a DCR Template and generates a relative html page and submit his work for approval.
After approval workflow engine starts Opendeploy and DataDeploy process.
I must deploy in a database table some values of a DCR Fieds and the URL of HTML Page tha it was generate.
So I tried to parse a DCR after generation process and modify a value of a node URLProducts.
I put this code in TPL
sub WriteUrlNode{
my $OutputPath = shift;
my $DcrPath = shift;
my (
@line
,$PathPage,$strToCompare,$IndexValue);
my $line;
$line=1;
$strToCompare="<item name=\"urlprodotto\">";
$PathPage = &decodePath($OutputPath,$WorkArea);
$FileName ="$DcrPath"."_prova";
open (INPUTDCR,"$DcrPath");
while(<INPUTDCR>){
push
@line
,$_;
}
close (INPUTDCR);
open(OUTPUTDCR,">$DcrPath");
for($i;$i<scalar(
@line)
;$i++){
if(index($line[$i],$strToCompare)>0){
$line[$i+1] =~ s/^(.*)/<value>$PathPage<\/value>/g;
}
print OUTPUTDCR $line[$i];
}
close(OUTPUTDCR);
Adam Stoller
It's very simple use-case.
Contributor fills a DCR Template and generates a relative html page and submit his work for approval.
After approval workflow engine starts Opendeploy and DataDeploy process.
I must deploy in a database table some values of a DCR Fieds and the URL of HTML Page tha it was generate.
So I tried to parse a DCR after generation process and modify a value of a node URLProducts.
Are you saying that you want to change the contents of the DCR to include a field that provides the path / URL of the page that was generated from that DCR??
What happens if you generate more than one page from a single DCR?
Why not use TeamSite Extended Attributes to store the name of the generated page ? That way you wouldn't have to parse through the DCR nor attempt to change it's contents - you could use iwextattr to retrieve any previous value and/or to set or append any new value.
DataDeploy works with extended attributes as well as DCR content.
I guess I'm still failing to see why you need to programatically alter the contents of the DCR after the contributor has finished entering the data.
--fish
(Interwoven Senior Technical Consultant)
carletto
Thanks Fish!
First of all, where I can find documentation about iwextattr and his integration with datadeploy?
Adam Stoller
For information about iwextattr - try
iwextattr -h
or look in the
TeamSite Command Line Tools
manual.
For information about DataDeploy - read the Data Deploy manuals.
--fish
(Interwoven Senior Technical Consultant)