Author: mrglavas
Date: Fri Oct 31 11:46:14 2008
New Revision: 709531

URL: http://svn.apache.org/viewvc?rev=709531&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/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/AbstractDOMParser.java

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/AbstractDOMParser.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/AbstractDOMParser.java?rev=709531&r1=709530&r2=709531&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/AbstractDOMParser.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/parsers/AbstractDOMParser.java
 Fri Oct 31 11:46:14 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to