W3C home > Mailing lists > Public > www-html@w3.org > November 2003

Re: XML in textarea problem

From: Andrew Clover <and-w3@doxdesk.com>
Date: Tue, 4 Nov 2003 09:19:51 +0000
To: www-html@w3.org
Message-ID: <20031104091951.GA26015@doxdesk.com>

Cortland Haws <pixelcort@pixelcort.com> wrote:

>> <textarea>
>>   <p>Blah, blah, blah.</p>
>> </textarea>

> How does one go about doing this

The <p> here is not markup, it is literal text content and should be
encoded as such:

  <textarea>
    &lt;p>Blah, blah, blah.&lt;/p>
  </textarea>

Otherwise not only will tools get confused about '<' and '&' characters,
but the string "</textarea>" will completely mess up the page (with possible
cross-site-scripting implications).

> In relativity, how could XForms address this issue?

There isn't really an issue. But if you really want to write literal text
without having to escape '<' and '&' in XHTML docs, a CDATA section will
do it:

  <textarea><![CDATA[
    <p>Blah, blah, blah.</p>
  ]]></textarea>

-- 
Andrew Clover
mailto:and@doxdesk.com
http://www.doxdesk.com/
Received on Tuesday, 4 November 2003 04:38:59 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 23:40:09 UTC