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/10/14 16:37:31 UTC

DO NOT REPLY [Bug 23812] New: - CDATA declaration moved during transform

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=23812>.
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=23812

CDATA declaration moved during transform

           Summary: CDATA declaration moved during transform
           Product: Xerces2-J
           Version: 2.5.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: DOM
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: blades@gecko.org.uk


When performing a transform using JDK 1.4.02 and Xalan 1.5.1 on an xml document 
containing cdata declarations like this:

<test>
	<check><![CDATA[some data in here]]></check>
</test>

the result of using a simple stylesheet to perform a transform programatically 
e.g.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
	<xsl:output method="xml" indent="yes"/>
	<xsl:template match="/">
		<xsl:copy-of select="/"/>
	</xsl:template>
</xsl:stylesheet>

produces the following output:

<?xml version="1.0" encoding="UTF-8"?><test xmlns="">
        <![CDATA[<check>]]>some data in here</check>
</test>

This is obviously invalid XML.  The same transform run using Xalan 2.4.1 is 
successful, but versions 2.5.0 and 2.5.1 both cause this error.

The code being used to execute the transformation is as follows:

byte[] array = XSL.getBytes(); // xsl is a string containing the xsl file
ByteArrayInputStream inputStream = new ByteArrayInputStream(array);
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource
(inputStream));
DOMSource domSource = new DOMSource(message); // message is a DOM Document 
representation of the input file
DOMResult result = new DOMResult();
transformer.transform(domSource, result);

Performing the above transformation with a StreamResult instead of a DOMResult 
produces the expected output.

I also tried running the transformation at the command line, but the output 
from that class did not include the CDATA declarations at all.

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