Invenzzia »

IMPORTANT ANNOUNCEMENT

Due to the uncertain status of the Flyspray project, lack of new releases and moving the code repository to Github, we decided to shutdown this issue tracker by the end of January 2011. From that date, the bugs should be reported directly in Github project repositories.

List of repositories:

Open Power Template 2.x family

PLEASE PROVIDE THE TEMPLATES AND/OR PHP CODE IN THE TASK DESCRIPTION (Not URL-s to them). THAT ALLOWS US TO REPRODUCE THE PROBLEM! OTHERWISE WE ARE NOT ABLE TO HELP YOU!

Remember to hide all the security-related pieces of code from the task description, like passwords, server paths etc. for your own safety. Once we close the task, we cannot edit it anymore!
Tasklist

FS#54 - CDATA behavior contolled by opt:literal

Attached to Project: Open Power Template
Opened by Skruppy (Skrupellos) - Sunday, 22 February 2009, 06:31 GMT-7
Last edited by Zyx (Zyx) - Sunday, 22 February 2009, 23:44 GMT-7
Task Type Feature Request
Category Instructions
Status Closed
Assigned To No-one
Operating System OS-independent
Severity Medium
Priority Normal
Reported Version 2.0-beta2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

DESCRIPTION:
It is currently not possible to write HTML code in Javascript, to be more exact it is not possible to write ">" and "<" in a CDATA section, if the compiler is in XML mode. This makes sense because you can't assure that the output is valid XML, because OPT doesn't parse it, but also you can't prove the opposite. This is a quite common problem, so there should be a way to stay in XML mode and say "Yes I assure that my CDATA is valid XML or is in a CDATA environment!".


EXAMPLE:
The following code is invalid in XML mode, but the output would be a valid XML:
----- code -----
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<opt:root>
<script type="text/javascript">
<opt:literal type="comment_cdata">
<![CDATA[
alert('<sender>John Smith</sender>');
]]>
</opt:literal>
</script>
</opt:root>
----- END code -----


(SOLUTION):
My idea is that CDATA should check the "type" attribute of its next opt:literal. If "type" is "cdata" or "comment_cdata" there is no problem to allow "<" and ">" else these characters are forbidden. To be more flexible there should be also an attribute like "checkxml", "xml", "vlid" or whatever to overwrite the default behavior defined by the "type" attribute.


PROBLEM:
This solution has a tiny problem. The following code would generate an invalid XML output:
----- code ------
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<opt:root>
<opt:literal type="comment_cdata">
<![CDATA[]]]]><![CDATA[>]]>
</opt:literal>
</opt:root>
----- END code -----




I think this is a quite common problem, so I set the severity to medium.
This task depends upon

Closed by  Zyx (Zyx)
Sunday, 22 February 2009, 23:44 GMT-7
Reason for closing:  Fixed
Additional comments about closing:  Fixed and improved in rev. 59
Comment by Zyx (Zyx) - Sunday, 22 February 2009, 10:34 GMT-7
Ech, this is caused by my newest invention - I noticed that OPT could accept "<" and ">" as a static text and I made a filter to the Opt_Xml_Cdata nodes that prevents such situations... but obviously I forgot about CDATA sections. Will be fixed soon, I'm writing the appropriate unit tests for this case now.

Loading...