Re: XML in textarea problem

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