Tapestry
  1. Tapestry
  2. TAPESTRY-1818

Template parser should handle CDATA blocks

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.5
    • Fix Version/s: 5.0.8
    • Component/s: tapestry-core
    • Labels:
      None

      Activity

      Hugo Palma created issue -
      Hide
      Chris Lewis added a comment - - edited

      <script> and <style> blocks are declared as having PCDATA in XHTML 1.0 (http://www.w3.org/TR/xhtml1/#h-4.8). I personally view this as broken since characters '<' and '>' are quite important in CSS ans Javascript. Aside from that, it presented me with a problem (currently unsolvable) using T5. I use some 'raw script' to configure some JS behavior, injected into the page body using addScript. In my case I needed to match some elements based on a selector using the prototype method getElementsBySelector (http://www.prototypejs.org/api/element/getelementsbyselector). In the selector I used the direct child operator ('>'), and after 20-30 minutes of confusion, realized that T5 was filtering this to an entity (for XML correctness).

      The problem is that there's no way around this. When the content is declared as having <![CDATA[ . . . ]]>, T5 throws the painful exception:

      "Not implemented yet: CDATA[ ... ]"

      Show
      Chris Lewis added a comment - - edited <script> and <style> blocks are declared as having PCDATA in XHTML 1.0 ( http://www.w3.org/TR/xhtml1/#h-4.8 ). I personally view this as broken since characters '<' and '>' are quite important in CSS ans Javascript. Aside from that, it presented me with a problem (currently unsolvable) using T5. I use some 'raw script' to configure some JS behavior, injected into the page body using addScript. In my case I needed to match some elements based on a selector using the prototype method getElementsBySelector ( http://www.prototypejs.org/api/element/getelementsbyselector ). In the selector I used the direct child operator ('>'), and after 20-30 minutes of confusion, realized that T5 was filtering this to an entity (for XML correctness). The problem is that there's no way around this. When the content is declared as having <![CDATA[ . . . ]]>, T5 throws the painful exception: "Not implemented yet: CDATA[ ... ]"
      Hide
      Howard M. Lewis Ship added a comment -

      The fix for this is part of the fix for TAPESTRY-1600.

      You have to be careful to use a <!DOCTYPE> and set the content type for the page to be "text/xml". Only then is the XML Markup Model used, which supports CDATA sections.

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      in the template and

      @Meta("tapestry.response-content-type=text/xml")

      in the Java code.

      Show
      Howard M. Lewis Ship added a comment - The fix for this is part of the fix for TAPESTRY-1600 . You have to be careful to use a <!DOCTYPE> and set the content type for the page to be "text/xml". Only then is the XML Markup Model used, which supports CDATA sections. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> in the template and @Meta("tapestry.response-content-type=text/xml") in the Java code.
      Howard M. Lewis Ship made changes -
      Field Original Value New Value
      Assignee Howard M. Lewis Ship [ hlship ]
      Howard M. Lewis Ship made changes -
      Fix Version/s 5.0.8 [ 12312898 ]
      Status Open [ 1 ] Closed [ 6 ]
      Resolution Fixed [ 1 ]
      Mark Thomas made changes -
      Workflow jira [ 12414862 ] Default workflow, editable Closed status [ 12568190 ]
      Mark Thomas made changes -
      Workflow Default workflow, editable Closed status [ 12568190 ] jira [ 12591271 ]

        People

        • Assignee:
          Howard M. Lewis Ship
          Reporter:
          Hugo Palma
        • Votes:
          4 Vote for this issue
          Watchers:
          4 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved:

            Development