You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2008/10/31 19:45:53 UTC

svn commit: r709530 - /xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java

Author: mrglavas
Date: Fri Oct 31 11:45:53 2008
New Revision: 709530

URL: http://svn.apache.org/viewvc?rev=709530&view=rev
Log:
Fixing JIRA Issue #1334:
http://issues.apache.org/jira/browse/XERCESJ-1334

If the name of element in the document below the root element happens to be match the
name of the root element we were not passing this node to the acceptNode() method of
an LSParserFilter. This was occurring because we were doing the check based on the name
of the node instead of identity with the root element object. This if fixed now thanks
to the patch from Arthur De Magalhaes.

Modified:
    xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java

Modified: xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java?rev=709530&r1=709529&r2=709530&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java Fri Oct 31 11:45:53 2008
@@ -241,8 +241,8 @@
     /** True if inside DTD external subset. */
     protected boolean fInDTDExternalSubset;
 
-    /** Root element name */
-    protected final QName fRoot = new QName();
+    /** Root element node. */
+    protected Node fRoot;
 
     /** True if inside CDATA section. */
     protected boolean fInCDATASection;
@@ -386,6 +386,7 @@
         fCurrentNode = null;
         fCurrentCDATASection = null;
         fCurrentEntityDecl = null;
+        fRoot = null;
     } // dropDocumentReferences()
 
     //
@@ -434,7 +435,7 @@
         fStringBuffer.setLength (0);
 
         // reset state information
-        fRoot.clear();
+        fRoot = null;
         fInDTD = false;
         fInDTDExternalSubset = false;
         fInCDATASection = false;
@@ -1020,9 +1021,9 @@
 
             // filter nodes
             if (fDOMFilter != null && !fInEntityRef) {
-                if (fRoot.rawname == null) {
+                if (fRoot == null) {
                     // fill value of the root element
-                    fRoot.setValues(element);
+                    fRoot = el;
                 } else {
                     short code = fDOMFilter.startElement(el);
                     switch (code) {
@@ -1310,7 +1311,7 @@
                     }
                 }
                 setCharacterData (false);
-                if (!fRoot.equals(element) && !fInEntityRef && (fDOMFilter.getWhatToShow () & NodeFilter.SHOW_ELEMENT)!=0) {
+                if ((fCurrentNode != fRoot) && !fInEntityRef && (fDOMFilter.getWhatToShow () & NodeFilter.SHOW_ELEMENT)!=0) {
                     short code = fDOMFilter.acceptNode (fCurrentNode);
                     switch (code) {
                         case LSParserFilter.FILTER_INTERRUPT:{



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org