[opencms-dev] Inline Javascript within CDATA throwsXMLunmarshalling error
Brock Haywood
BHaywood at BCLC.com
Mon Jan 19 16:41:30 CET 2009
Thanks for your suggestions,
I think the only choice that I have is to put that into a jsp template.
My script code is an external js file and that code that I had presented
is 'page specific' and calls the SWFObject with different parameters.
Also, I do realize that this specific javascript doesn't require a CDATA
but the xstandard editor always inserts the CDATA blocks to ensure that
all javascript is xhtml compliant.
Regards,
brock
-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Christian Steinert
Sent: January 16, 2009 2:41 PM
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Inline Javascript within CDATA
throwsXMLunmarshalling error
Brock Haywood ha scritto:
> This seems to be the result having nested CDATA sections. I've looked
> at the control code for the webpage and because everything in that
pages
> <content> node is within a CDATA section, when I use my own CDATA
> section, it blows up the xml.
>
> Is there anyway to dynamically add the CDATA sections to my content?
Or
> something else to handle this problem?
>
Why don't you use a JSP template to assemble your final page and add the
script section there.
Also, why don't you stick your script code into an external .js file -
then you won't need a cdata section at all. And for the specific
Javascript code that you quoted, you won't need a cdata block - in this
specific case, you have nothing therein that would make your xhtml
invalid even when leaving away the CDATA wrapping.
You definitely cannot nest cdata sections, because in XML, the first ]]>
will terminate any CDATA that was opened before.
Regards
Christian
> Thanks,
>
> Brock
>
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Brock Haywood
> Sent: January 15, 2009 1:00 PM
> To: opencms-dev at opencms.org
> Subject: [opencms-dev] Inline Javascript within CDATA
> throwsXMLunmarshalling error
>
> Hi,
>
> I'm trying to migrate a site to opencms. I've run into a problem
where
> there is some inline javascript in a content html page. The following
> code produces this error:
> Unmarshalling XML document failed.
> Reason: Error on line 55 of document : The element type
> "content" must be terminated by the matching end-tag "</content>".
> Nested exception: The element type "content" must be terminated by the
> matching end-tag "</content>".
>
> Here's the code:
>
> <script type="text/javascript">
> //<![CDATA[
> var so = new SWFObject(
> "/Banner/loader/bannerLoader.swf",
> "homepage",
> "550", "217",
> "7",
> "#FFFFFF");
> so.addParam("wmode", "transparent");
> so.addParam("allowScriptAccess", "sameDomain");
> so.addVariable("BannerFilePath", "/Banner/bannerConfig.xml");
> so.write("SWFBanner");
> //]]>
>
> </script>
>
> I've narrowed it down to the CDATA sections within the script tags.
If
> I remove that then the page saves correctly, however, I am using the
> xstandard editor so we can guarantee xhtml compliant code so this is
not
> really an options for me.
>
> Can anyone suggest a workaround or what I'm doing wrong? I'm using
> OpenCms 7.0.5.
>
> Thanks,
>
> Brock
>
>
>
> This email is intended only for the addressee. It may contain
> confidential or proprietary information that cannot be disclosed
without
> BCLC's permission. If you have received this email in error, please
> notify the sender immediately and delete the email.
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please
> visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
>
>
> This email is intended only for the addressee. It may contain
confidential or proprietary information that cannot be disclosed without
BCLC's permission. If you have received this email in error, please
notify the sender immediately and delete the email.
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please
visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
>
_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please
visit
http://lists.opencms.org/mailman/listinfo/opencms-dev
This email is intended only for the addressee. It may contain confidential or proprietary information that cannot be disclosed without BCLC's permission. If you have received this email in error, please notify the sender immediately and delete the email.
More information about the opencms-dev
mailing list