Closed Bug 265101 Opened 20 years ago Closed 19 years ago

CDATA Tags partially removed from XML document

Categories

(Firefox :: General, defect)

x86
Windows 2000
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 255553

People

(Reporter: iain.rose, Assigned: bugzilla)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; rv:1.7.3) Gecko/20041001 Firefox/0.10.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; rv:1.7.3) Gecko/20041001 Firefox/0.10.1

I am testing firefox with a web page that displays XML content in an editable
text box. The page is extremely basic and only contains the test box, a save
button and a cancel button.

If I view some XML that contains text wrapped in CDATA tags, the leading <! is
being removed from the displayed content.


Reproducible: Always
Steps to Reproduce:
eg. XML content as saved in DB (SQL Server 2000) and displayed in IE as:

     <criticalityquestion>
          <showCrit>True</showCrit>
          <question>
               <![CDATA[Will you use this site again?]]> 
          </question>
          <shortform><![CDATA[Will use again]]>
          </shortform>
          <optionlabel><![CDATA[Yes;Maybe;No]]>
          </optionlabel>
          <optionvalue><![CDATA[Yes;Maybe;No]]>
          </optionvalue>
          <OptionColor><![CDATA[#008000 ;#FFFF99 ; #FF3333]]>
          </OptionColor>
     </criticalityquestion>

XML as displayed in Firefox

     <criticalityquestion>
          <showCrit>True</showCrit>
          <question>
               [CDATA[Will you use this site again?]] 
          </question>
          <shortform>[CDATA[Will use again]]
          </shortform>
          <optionlabel>[CDATA[Yes;Maybe;No]]
          </optionlabel>
          <optionvalue>[CDATA[Yes;Maybe;No]]
          </optionvalue>
          <OptionColor>[CDATA[#008000 ;#FFFF99 ; #FF3333]]
          </OptionColor>
     </criticalityquestion>

If I view the page source in Firefox I can see that the CDATA tags are still
intact and correctly formed.

However if I edit the text and click save, then check the content in the
database or IE I can see that all CDATA tags have been partially stripped out
and my entire XML string is corrupted
Count yourself lucky: I once had Mozilla eat my dog under similar circumstances.

The contents of <textarea> are PCDATA, parsed character data, per the HTML spec,
so Gecko parses it and then does weird things with it if you haven't converted
every < to &lt;. If you make that conversion as you generate the page,
everything will work perfectly (as long as you don't get visited by some early
versions of IE/Mac, which don't convert entities in textareas).

*** This bug has been marked as a duplicate of 255553 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.