Home
TeamSite
Createing DCR's from script......how do I encode??
Tob
I have created a perl script that uses regular expressions to extract information between two delimiting strings (<!-- content begins here --> and <!-- content ends here -->) and inserts the information into the value tags of a new DCR. Within my script I am using TeamSite::CGI_lite::escape_html_data($strValue) to escape html characters. I am also running the “iwextattr -s TeamSite/Templating/DCR/Type=” command to set the metadata so teamsite recognizes it as a DCR. Everything works great until I encounter some characters such as dashes, hyphens, apostrophes, or colons. When I encounter these special characters I get an error massage that reads…
Templating Error Page
An exception was thrown: Error parsing Data Content Record Departments#performance_excellence#pm_biblio.asp: Stopping after fatal error: The element type "value" must be terminated by the matching end-tag "".
I can use regular expressions again to replace each of these special characters with the equivalent HTML named or numbered entity but I’m hoping there is some interwoven tool I can use to make the conversion for me. Any ideas?
Thanks!!
Find more posts tagged with
Comments
Migrateduser
It would be great if someone from Interwoven could address your post.
Can you post one of the DCRs?
I think < needs to be escaped as <, etc. I think it may be difficult to use an HTML parser - I did something similar recently and had to do something custom. This is unsupported and won't cover it all, but it looked something like this:
sub fixForDCR( $ )
{
my $input = shift(
@_
);
$input =~ s#\&#&#g;
$input =~ s#<#<#g;
$input =~ s#>#>#g;
$input =~ s#"#"#g;
$input =~ s#’#&rsquo;#g;
$input =~ s#´#&rsquo;#g;
$input =~ s#‘#&lsquo;#g;
$input =~ s#“#&ldquo;#g;
$input =~ s#”#&rdquo;#g;
$input =~ s#–#&mdash;#g;
$input =~ s#—#&mdash;#g;
$input =~ s#©#&copy;#g;
$input =~ s#®#&copy;#g;
$input =~ s#> #>#g;
$input =~ s#> #>#g;
$input =~ s# <#<#g;
$input =~ s#> #>#g;
return( $input );
}