You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Robert Houben <Ro...@fusionware.net> on 2004/03/09 04:13:10 UTC

Question about text nodes and CDATA sections

I have the following XML:

<PingTest2><![CDATA[Hello ]]></PingTest2>

 

In my program I append a text node so that I get this result:

 

<PingTest2><![CDATA[Hello ]]> world!</PingTest2>

 

When I execute the following function:

 

exprValue = XPathAPI.eval(contextNode, XPathString);

 

I get a NodeSet with only the CDATA section.  If I reverse the order,
and have a text node, then append a CDATA section, I get the text node
only.

 

This appears to be a DOM restriction regarding how text nodes in an
element with no markup are to be stored, but Xerces is allowing me to
create the anomaly in the first place.  Is this correct behavior? Is it
possibly illegal on my part and I just shouldn't do this? 

 

Thanks,

 

Robert