[opencms-dev] A really weird XML Template related bug in 4.6

Werner Punz werpu at gmx.at
Tue May 14 15:14:31 CEST 2002


Hi Hanjo thanks for the fast response.

Hi I think there is a slight misunderstanding here. The problem is, that if
you edit the sourcecode
of an XML element file or HTML page and if you have <![CDATA[ ]]> tags in
between (no matter if it is XML or HTML)
the files are stored incorrectly due to a bug in CmsXMLTemplateFile, the
problem I discovered is
that the internal <![CDATA[]]> tags are totally ignored when the bodies are
generated (I gave a small reproducable example in my first post). Doesn´t
matter what method is called in the backend the problem aready occurs at the
storage level.
The second post was about the code which causes this behavior (the affected
code is called when you store an xml template from the source editor). I
already found a workaround. I reverted to the method implemented in 4.4.1 and it
works again. 
You can reproduce this behavior by making 

Forget about the deprecated method in my example, it is just to show the
affects of the bug. (aka if you implement
it and use something else as XML tag, following still happens (I could
reproduce it with other tags like process as well)

In the content file, the editor part as a fully correct XML file. The body
part has a ]]> due to the fact
that it doesn´t resolve the ]]> in between correctly (it looks only for a
]]> at the end of the file and skips everything else in between. Thus the
result is a HTML file with XML tags in between which are not resolved correctly! I
now reverted to the old 4.4.1 code in this method and things work again.

I hope this clears things up.







-----Ursprüngliche Nachricht-----
Von: owner-opencms-dev at www.opencms.org
[mailto:owner-opencms-dev at www.opencms.org]Im Auftrag von Hanjo Riege
Gesendet: Dienstag, 14. Mai 2002 14:50
An: 'opencms-dev at www.opencms.org'
Betreff: AW: [opencms-dev] A really weird XML Template related bug in
4.6



Hi Werner,

im not sure if i understand the problem right. 
 I don't think you need CDATA tags when editing a page. In your example you
use the method getServletPath in a page. This method is deprecated and
should not be used, specially not in a page. There you just enter the link
like <A href="/test.html" target=_self>testlink</A>. Then OpenCms will
generate the code with the link tags needed by the System: <a
href="]]><LINK><![CDATA[/test.html]]></LINK>. The servlet path is added when
the template engine generates the page. 

 If you edit a template or an element you should use "Edit Sourcecode"
instead of "Edit Html". Then you have to set the link tags by yourself. I
know the manual still uses the getServletPath method in the examles. I hope
we will find some time to correct this soon. 

I hope this helps.

Greetings

Hanjo

-----Ursprüngliche Nachricht-----
Von: Werner Punz [mailto:werpu at gmx.at]
Gesendet: Dienstag, 14. Mai 2002 13:01
An: opencms-dev at opencms.com
Betreff: [opencms-dev] A really weird XML Template related bug in 4.6


Hi I spent the last several days researching into a weird XML related bug,
which I now could nail down to OpenCMS 4.6. (I and another Guy from germany
(thanks Clemens Wilkens to test several things out for me) could reproduce
the
bug, and so far I nailed it down to several parts, where I´m not exactly
sure
which one of them causes it, but the bug is definitely caused there.

Here is the description:

Following construct:


Mastertemplate; 
<?xml version="1.0"?> 
<XMLTEMPLATE> 
<TEMPLATE> 

<ELEMENT  name = "body"/> 

</TEMPLATE> 
</XMLTEMPLATE> 


The page which uses the mastertemplate above
  
<![CDATA[ test ]]> <method name="getServletPath"/> <![CDATA[test2]]> 


What happens is that the page is resolved into something follwing construct

test ]]> 

There seems to me a bug in xml resolution, cause I have similar problems
using XML elements. This only occurs however if the page and the template
are
created new not imported from an older project.
I debugged into the system the last 3 hours and found out that the error
already occurs at the time the XML template is written from the temporary
file.
So my conclusion, it either is already written down incorrectly into the
temporary file, or there is a bug in the CmsXmlControlFile class. I haven´t
debugged into the class yet to see if my conclusions are correct. But I
would need
a comment from the OpenCMS developers regarding this problem and if it is
fixed already in the CVS tree and where!


Kind Regards Werner Punz Labor_C
http://www.labor-c.net

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net




More information about the opencms-dev mailing list