Adding text nodes (even if they are just whitespace) as children of root
causes a DOM006 exception in the document builder. Hence, these text nodes
are now ignored.
git-svn-id: https://svn.apache.org/repos/asf/xalan/java/trunk@336217 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/org/apache/xalan/xsltc/trax/SAX2DOM.java b/src/org/apache/xalan/xsltc/trax/SAX2DOM.java
index 9cd741c..8fd398c 100644
--- a/src/org/apache/xalan/xsltc/trax/SAX2DOM.java
+++ b/src/org/apache/xalan/xsltc/trax/SAX2DOM.java
@@ -102,8 +102,8 @@
final Node last = (Node)_nodeStk.peek();
final String text = new String(ch, start, length);
- // Only whitespace text nodes can be children of root
- if (last != _document || text.trim().length() == 0) {
+ // No text nodes can be children of root (DOM006 exception)
+ if (last != _document) {
last.appendChild(_document.createTextNode(text));
}
}