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)
XML Parse Error After Upgrade
dlsoderberg
We recently upgraded our version of TeamSite from 6.0 to 6.1 (on our way to 6.5). I have a template that worked prior to the upgrade now giving the dreaded XML parse error. I know that iwperl was upgraded with TS 6.1 to 5.8.x. I cannot see the problem with the code we have in the template, however. Here is the error we're getting:
Preview And Generate Preview And Generate:
XML parse error:
no element found at line 1, column 0, byte -1 at /apps/Interwoven/TeamSite/iw-perl/vendor/lib/XML/Parser.pm line 187
:/default/main/newellco/WORKAREA/load/templatedata/newellco/investor/presentation/investor.tpl
And here is the code I have narrowed it down to...If I take out all of the substitutions, it works fine. Can anyone lend a hand in determing what's wrong with the substitutions? Thanks in advance!
<![CDATA[<div class="mainSub">]]>
<iw_perl><![CDATA[
$content = iwpt_dcr_value("dcr.Main_Content");
if (iwpt_get_dcr_name() eq "investorPresentations"){
$content =~ s/<div>/<div class="mainSubSmall">/g;}
$content =~ s/Â//g;
#$content =~ s/<p>(.*)<\/p>/$1<\/BR><\/BR>/g;
$content =~ s/<p>//g;
$content =~ s/<p align="center">//g;
$content =~ s/é/é/g;
$content =~ s/<\/p>/<\/BR><\/BR>/g;
$content =~ s/target="_blank"/target="_blank" class="orange"/g;
$content =~ s/target="blank"/target="_blank" class="orange"/g;
iwpt_output("$content");
]]>
</iw_perl>
Find more posts tagged with
Comments
Adam Stoller
If I had to guess (I don't have to, but I will) - I'd say it was the line highlighed below, above the line you commented out, that was actually causing the problems (why the line you commented out seemed to have an affect I don't know):
...
$content =~ s/<div>/<div class="mainSubSmall">/g;}
$content =~ s/
�
//g;
#$content =~ s/<p>(.*)<\/p>/$1<\/BR><\/BR>/g;
...
Also - a few comments for improving the readability of your code:
Use the non-strict-XML format of PTs, so you don't have <![CDATA[ ... ]]> tags all over the place
Use a different character for the substitution regex separator so you don't have to 'escape' everything. E.g., this is probably a lot easier to read:
$content =~ s{<p>(.*)</p>}{$1</BR></BR>}g;
You should probably be using
gsmi
as the regex modifier instead of just
g
You also probably do not want
(.*)
, but rather
(.*?)
becuase if you have multiple begin/end paragraph statements the former would pull them
all
in whereas the latter would handle them one at a time (though if you have
nested
paragraph markers, you'll still have problems using the regex).
Examine your HTML code in your regex carefully - because I don't think you want
<
/
BR>
, I think you want
<BR
/
>
- and even more correctly -
<br/>
since all-uppercase-tag names is so passe
...
$content =~ s
{
<p>(.*
?
)</p>
}{
$1<
br
/
><
br>b>/
>
}
g
smi
;
...
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com