You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Robert Houben <Ro...@fusionware.net> on 2006/06/01 16:59:08 UTC

Issue with text nodes

I have a problem, for which I have found a somewhat undesirable work
around.  It seems that when I issue an XPath statement that ends with
"text()", on some systems, especially ones where memory and performance
are a bit of an issue, I get only a portion of the text.  This sounds a
bit like a side-effect of the fact that characters() can be called
multiple times by SAX for a single text node.

 

If I take the containing node (or one of its ancestors) and do a
node.normalize(), the problem goes away.  This has bitten me with large
documents returned by an XSLT transform using xalan. I now do a
node.normalize() on the document element, but my guess is that this has
possibly huge performance problems on a system that already suffers
(memory utilization by xalan for XSLT is unbelievable!)

 

Is there something else I can do to prevent this behaviour and avoid
having to do the node.normalize() call everytime I may have manipulated
a text node?

 

TIA,


Re: Issue with text nodes

Posted by Joseph Kesselman <ke...@us.ibm.com>.
Question: When you say you're modifying the DOM, do you mean you're
modifying it after running Xalan on it, and then invoking another Xalan
operation on it (eg, patching the DOM from inside an XSLT extension
function, or between calls to the CachedXPathAPI)?

If so... Xalan builds a mapping from the DOM to its internal
representation, and does not know when/how to update that if the DOM is
altered afterward. The result can indeed be that the two models fall out of
synch.

______________________________________
"... Three things are most perilous: Connectors that corrode,
  Unproven algorithms, and self-modifying code! ..."
  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish
(http://www.ovff.org/pegasus/songs/threes-rev-11.html)