[MAGNOLIA-1530] Add escapeXml attribute to cms:out tag Created: 11/May/07  Updated: 23/Jan/13  Resolved: 14/Aug/08

Status: Closed
Project: Magnolia
Component/s: taglibs
Affects Version/s: 3.0.2
Fix Version/s: 3.6.2, 3.6.3

Type: Improvement Priority: Major
Reporter: Sean McMains Assignee: Jan Haderka
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

All


Attachments: Text File escapeXmlPatch.txt     File escapexml.diff    
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

In order to generate validating XHTML and XML, it would be very useful to have an escapeXml attribute for the cms:out tag. Currently one has to rely on JSTL to get proper escaping, like this:

<cms:out nodeDataName="text" var="text"/><c:out value="${text}"/>

(Note the JSTL c:out tag escapes by default, though you can turn it off with its escapeXml attribute.)

It would be nicer to be able to do this:

<cms:out nodeDataName="text" escapeXml="true" />

Since magnolia templates (FCK Editor paragraphs especially) rely on the existing behavior, this attribute probably needs to default to false, rather than true as the JSTL template does.



 Comments   
Comment by Sean McMains [ 11/May/07 ]

Here's a patch to provide the described functionality.

Comment by Sean McMains [ 07/Dec/07 ]

As it turns out, StringEscapeUtils.escapeXml() outputs the ' entity. IE doesn't support that entity, which results in anything with apostrophes being displayed incorrectly. I'm attaching an updated patch that uses the numeric form of the ' entity and displays correctly on all browsers.

Comment by Jan Haderka [ 14/Aug/08 ]

Applied on trunk. Thanks for the patch.
r17347

Generated at Mon Feb 12 03:27:48 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.