Can anybody comment on this? Is this a bug?

Thanks,

Alec

On Sun, Jan 22, 2012 at 11:50 AM, Alec Swan <alecs...@gmail.com> wrote:
> The following workaround works but violates encapsulation. Why doesn't
> AjaxRequestTarget.AjaxHeaderResponse class escape special XML
> characters?
>
> public void renderHead(IHeaderResponse response) {
>        String scriptToRender = "<script>if (1 == 1 && true)
> alert('Hello!')</script>";
>        if (scriptToRender != null) {
>            if (AjaxRequestTarget.get() != null) {
>                scriptToRender = scriptToRender.replace("&", "&amp;");
> // todo: escape other XML special characters
>            }
>            response.renderString(scriptToRender);
>        }
>    }
>
> Thanks,
>
> Alec
>
> On Sun, Jan 22, 2012 at 12:14 AM, Alec Swan <alecs...@gmail.com> wrote:
>> Hello,
>>
>> I am using Wicket 1.4.17 and have a panel which implements
>> IHeaderContributor as follows:
>>
>> public void renderHead(IHeaderResponse response) {
>>  response.renderString("<script>if (1 == 1 && true) 
>> alert('Hello!')</script>");
>> }
>>
>> When the panel is updated as a part of AJAX request (by adding to ART)
>> the following error is shown in Debugger:
>>
>> ERROR: Error in parsing: XML Parsing Error: not well-formed
>> Location: http://localhost:8080/...
>> Line Number 1, Column 67:<head
>> xmlns:wicket="http://wicket.apache.org";><script>if (1 == 1 && true)
>> alert('Hello!')</script></head>
>>
>> Shouldn't ART's header contributor properly escape special XML
>> characters such as &? How can I fix this?
>>
>> Thanks,
>>
>> Alec

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to