> I am using Xalan-1.6.  I have a question about CDATA handling
> in one of your example, "SerializeNodeSet".
> 
>   In the example, you have a foo.xml.

...

> When I run the program by typing "SerializeNodeSet ./foo.xml / doc",
> I got the following result:
> 
> <doc>
> 
> this is the cdata test section
> 
>   <name last="Marston" first="David">Mr. Marston</name>

...

> The "<![CDATA[" and "]]>" symbol simply disappeared in the output.
> What I want is that these CDATA symbols still exists after running
> the program. 

CDATA sections are not preserved in the Infoset, or in the XPath data 
model, so they are lost after parsing the source document.

> Could you let me know how can I solve this problem?

FormatterListener::cdata() will generate a CDATA section with the supplied 
data.  However, you will have to modify the class FormatterTreeWalker to 
call the cdata() member function for the text nodes you want serialized in 
CDATA sections.

Relying on the preservation of CDATA sections is generally a bad idea, 
because they are considered a lexical artifact of the input XML document, 
rather than a part of the document's data.

Dave

Reply via email to