You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2003/11/11 23:34:32 UTC

DO NOT REPLY [Bug 24629] New: - XMLSerializer should write ]]> in text node as ]]>

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24629>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24629

XMLSerializer should write ]]> in text node as ]]&gt;

           Summary: XMLSerializer should write ]]> in text node as ]]&gt;
           Product: Xerces2-J
           Version: 2.0.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Serialization
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: ederksen@ncstech.com


I have an XML document with an escaped CDATA section in it:

<Item Item_ID="398" Semantic_Name="Album" Semantic_Set_Name="Garden Stuff">
  <Descriptor>Evan's Garden 2003 &lt;![CDATA[cdata]]&gt;</Descriptor>
</Item>

After reading it with Xerces and writing it out with XMLSerializer and 
setIndenting(true), it turns into:

<Item Item_ID="398" Semantic_Name="Album" Semantic_Set_Name="Garden Stuff">
  <Descriptor>Evan's Garden 2003 &lt;![CDATA[cdata]]></Descriptor>
</Item>

Xalan doesn't like this:

javax.xml.transform.TransformerException: 
org.apache.xml.utils.WrappedRuntimeException: The character sequence "]]>" must 
not appear in content unless used to mark the end of a CDATA section.

I suspect it is actually Xerces that throws the exception under the hood, but 
I'm not entirely sure. Anyway, section 2.4 of the XML Specification states:

    [14]    CharData    ::=    [^<&]* - ([^<&]* ']]>' [^<&]*) 

(Looks like some perl code I wrote once ;-)
It means that ]]> is not allowed in text blocks (just like the exception says.)

I think I'm using Xerces 2.5.0. Sorry I can't be more specific...

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org