Issue with text nodes 2006-06-01 - By Robert Houben
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,
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas -microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"> <meta name=Generator content="Microsoft Word 11 (filtered medium)"> <style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal-compose; font-family:Arial; color:windowtext;} @(protected) Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in;} div.Section1 {page:Section1;} --> </style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>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.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>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!)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>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?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>TIA,<o:p></o:p></span></font></p>
</div>
</body>
</html>
|
|