sboag 01/01/09 14:37:36
Modified: java/src/org/apache/xalan/stree StreeDOMBuilder.java
Log:
Move the shouldStripWS test from SourceTreeHandler to
StreeDOMBuilder, so that the test can be done after the text
has been accumulated from potentially multiple text nodes.
This addresses #SCUU4SPUML : Crimson: position70 has whitespace differences
Steps to Reproduce:
WinNT 4.0 SP5, JDK 1.1.8, Xalan 2.0.D06, xml-crimson built from CVS approx
03-Jan-01
xml-xalan\test
Copy crimson.jar into xml-xalan\java\bin
ConformanceTest.bat -crimson [-category position]
(Note the -crimson flag automatically adds crimson.jar instead of xerces.jar
in classpath, and sets two -D flags to use crimson jaxp classes)
From ConformanceTest.xml/.html: Note missing whitespace in various places
(only some shown)
gold-parse-type;[xml]; test-parse-type;[xml];
mismatch-value;TEXT_NODE(#text)len=253;TEXT_NODE(#text)len=232;lengths do not
match mismatch-value-gold;TEXT_NODE(#text);
A(1):attC(2): This is the 1st comment T(3): text-in-doc E(4):innerT(1):
inner-text C(2): This is the 2nd comment E(3):subT(1):subtext T(4): text-after
T(5): text-in-doc2 E(6):inner2A(1):blatE(1):subT(1):subtext T(2):final-text
mismatch-value-text;TEXT_NODE(#text);
A(1):attC(2): This is the 1st comment T(3): text-in-docE(4):innerT(1):
inner-textC(2): This is the 2nd comment E(3):subT(1):subtext T(4): text-after
T(5): text-in-doc2E(6):inner2A(1):blatE(1):subT(1):subtext T(2):final-text
Revision Changes Path
1.13 +9 -2
xml-xalan/java/src/org/apache/xalan/stree/StreeDOMBuilder.java
Index: StreeDOMBuilder.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/StreeDOMBuilder.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- StreeDOMBuilder.java 2001/01/02 03:26:40 1.12
+++ StreeDOMBuilder.java 2001/01/09 22:37:34 1.13
@@ -57,6 +57,7 @@
package org.apache.xalan.stree;
import org.apache.xml.utils.DOMBuilder;
+import org.apache.xml.utils.XMLCharacterRecognizer;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
@@ -82,7 +83,7 @@
* WARNING: Do NOT do a getNodeValue() or the like on this node while
* it is accumulating text, as that will cause a string to be made, and
* no more text will be obtained by the node! */
- Node m_text_buffer = null;
+ TextImpl m_text_buffer = null;
/** Source document node */
protected DocumentImpl m_docImpl;
@@ -235,6 +236,7 @@
throws org.xml.sax.SAXException
{
setPreviousIsText(false);
+ // ((Parent)getCurrentNode()).setComplete(true);
super.endElement(ns, localName, name);
}
@@ -381,7 +383,12 @@
if (m_previousIsText && !isText)
{
- append(m_text_buffer);
+ if (!(m_docImpl.m_sourceTreeHandler.getShouldStripWhitespace()
+ &&
XMLCharacterRecognizer.isWhiteSpace(m_text_buffer.m_doc.m_chars.m_map,
+ m_text_buffer.m_start, m_text_buffer.m_length)))
+ {
+ append(m_text_buffer);
+ }
m_text_buffer = null;
}