Bug 7731 - Serialization of CDATA sections is incorrect when CDATA terminator is split across CDATA sections
Summary: Serialization of CDATA sections is incorrect when CDATA terminator is split...
Status: NEW
Alias: None
Product: Xerces-J
Classification: Unclassified
Component: Serialization (show other bugs)
Version: 1.4.4
Hardware: Other All
: P3 normal
Target Milestone: ---
Assignee: Xerces-J Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-03 19:59 UTC by Mike Schilling
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
Patch to XMLSerializer.java to address this problem (1.31 KB, patch)
2002-04-03 20:04 UTC, Mike Schilling
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Schilling 2002-04-03 19:59:00 UTC
Parse the following document into a DOM tree, and use
org.apache.xml.serialize.XMLSerializer to serialize it.  

Document:

    <?xml version="1.0" encoding="UTF-8"?>
    <top><![CDATA[]]]]><![CDATA[>]]>
    </top> 

Result:
    <?xml version="1.0" encoding="UTF-8"?>
    <top><![CDATA[]]>]]>
    </top>
  
In the second line of the result:

    <![CDATA[  is the CDATA header

    ]] is the content of the first CDATA section

    > is the content of the second CDATA section

    ]]> is the CDATA terminator

The problem is XMLSerializer concatentating CDATA sections without checking if
that produces "]]>".
Comment 1 Mike Schilling 2002-04-03 20:04:29 UTC
Created attachment 1472 [details]
Patch to XMLSerializer.java  to address this problem
Comment 2 Mike Schilling 2002-04-03 20:23:10 UTC
Actually, the patch is to BaseMarkupSerializer.java