You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by el...@apache.org on 2002/01/11 23:07:18 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/parsers AbstractDOMParser.java

elena       02/01/11 14:07:18

  Modified:    java/src/org/apache/xerces/dom NodeImpl.java
               java/src/org/apache/xerces/parsers AbstractDOMParser.java
  Log:
  Bug fix: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5694
  
  If the same entity ref appeared more than once in the document, we would throw DOM exception: Modification not allowed.
  That happens because we synchronize entity reference nodes when fCurrentNode.getLastChild() (from characters()) is called on the entityref node. In the result we were automatically appending all content to the entity ref from the doctype and making this node read only.
  
  The fix: do not synchronize entity ref nodes when those are created by DOM parser. The DOM parser will append the correct content to the entity ref.
  
  Revision  Changes    Path
  1.46      +2 -2      xml-xerces/java/src/org/apache/xerces/dom/NodeImpl.java
  
  Index: NodeImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/NodeImpl.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- NodeImpl.java	10 Jan 2002 06:34:20 -0000	1.45
  +++ NodeImpl.java	11 Jan 2002 22:07:17 -0000	1.46
  @@ -115,7 +115,7 @@
    *
    * @author Arnaud  Le Hors, IBM
    * @author Joe Kesselman, IBM
  - * @version $Id: NodeImpl.java,v 1.45 2002/01/10 06:34:20 twl Exp $
  + * @version $Id: NodeImpl.java,v 1.46 2002/01/11 22:07:17 elena Exp $
    * @since  PR-DOM-Level-1-19980818.
    */
   public abstract class NodeImpl
  @@ -1137,7 +1137,7 @@
           return (flags & SYNCCHILDREN) != 0;
       }
   
  -    final void needsSyncChildren(boolean value) {
  +    public final void needsSyncChildren(boolean value) {
           flags = (short) (value ? flags | SYNCCHILDREN : flags & ~SYNCCHILDREN);
       }
   
  
  
  
  1.26      +6 -1      xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java
  
  Index: AbstractDOMParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- AbstractDOMParser.java	10 Jan 2002 06:34:23 -0000	1.25
  +++ AbstractDOMParser.java	11 Jan 2002 22:07:18 -0000	1.26
  @@ -102,7 +102,7 @@
    * @author Andy Clark, IBM
    * @author Elena Litani, IBM
    *
  - * @version $Id: AbstractDOMParser.java,v 1.25 2002/01/10 06:34:23 twl Exp $
  + * @version $Id: AbstractDOMParser.java,v 1.26 2002/01/11 22:07:18 elena Exp $
    */
   public abstract class AbstractDOMParser
       extends AbstractXMLDocumentParser {
  @@ -401,6 +401,9 @@
           if (fInDocument && !fInDTD && fCreateEntityRefNodes ) {
               if (!fDeferNodeExpansion) {
                   EntityReference er = fDocument.createEntityReference(name);
  +                // we don't need synchronization now, because entity ref will be
  +                // expanded anyway. Synch only needed when user creates entityRef node
  +                ((EntityReferenceImpl)er).needsSyncChildren(false);
                   fCurrentNode.appendChild(er);
                   fCurrentNode = er;
               }
  @@ -968,6 +971,8 @@
                           entities.setNamedItem(entity);
                       }
                   }
  +                // Make entity ref node read only
  +                ((NodeImpl)fCurrentNode).setReadOnly(true, true);
                   fCurrentNode = fCurrentNode.getParentNode();
               }
               else {
  
  
  

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