You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by le...@locus.apache.org on 2000/09/01 20:10:21 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/parsers DOMParser.java
lehors 00/09/01 11:10:20
Modified: java/src/org/apache/xerces/parsers DOMParser.java
Log:
the deferred DOM uses the string pool, so it cannot be reused
in subsequent parses. To avoid this a flag was added so that when we reset
the parser we create a new string pool if the current one is being used by
the DOM
Revision Changes Path
1.27 +10 -1 xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java
Index: DOMParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- DOMParser.java 2000/08/29 21:04:31 1.26
+++ DOMParser.java 2000/09/01 18:10:19 1.27
@@ -108,7 +108,7 @@
* DOMParser provides a parser which produces a W3C DOM tree as its output
*
*
- * @version $Id: DOMParser.java,v 1.26 2000/08/29 21:04:31 lehors Exp $
+ * @version $Id: DOMParser.java,v 1.27 2000/09/01 18:10:19 lehors Exp $
*/
public class DOMParser
extends XMLParser
@@ -202,6 +202,8 @@
private boolean fSeenRootElement;
+ private boolean fStringPoolInUse;
+
private XMLAttrList fAttrList;
//
@@ -314,6 +316,11 @@
/** Resets the parser. */
public void reset() throws Exception {
+ if (fStringPoolInUse) {
+ // we can't reuse the string pool, let's create another one
+ fStringPool = new StringPool();
+ fStringPoolInUse = false;
+ }
super.reset();
init();
}
@@ -363,6 +370,7 @@
fQuotIndex = fStringPool.addSymbol("quot");
fSeenRootElement = false;
+ fStringPoolInUse = false;
fAttrList = new XMLAttrList(fStringPool);
@@ -900,6 +908,7 @@
try { nsEnabled = getNamespaces(); }
catch (SAXException s) {}
fDeferredDocumentImpl = new DeferredDocumentImpl(fStringPool, nsEnabled, fGrammarAccess);
+ fStringPoolInUse = true;
fDocument = fDeferredDocumentImpl;
fDocumentIndex = fDeferredDocumentImpl.createDocument();
fCurrentNodeIndex = fDocumentIndex;