xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leh...@apache.org
Subject cvs commit: xml-xerces/java/src/org/apache/xerces/parsers DOMParser.java
Date Thu, 01 Feb 2001 21:45:50 GMT
lehors      01/02/01 13:45:49

  Modified:    java/src/org/apache/xerces/parsers DOMParser.java
  Log:
  Since checking for readonly nodes is off when errorchecking is
  off, we don't need to make entityref and entity nodes readwrite to build
  them, on the other hand we must set them as readonly once built.
  Also cleaned up some code by relying on fDocumentImpl and
  fDeferredDocumentImpl to figure out what DOM implementation we're dealing with.
  
  Revision  Changes    Path
  1.37      +7 -20     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.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- DOMParser.java	2001/02/01 17:14:30	1.36
  +++ DOMParser.java	2001/02/01 21:45:46	1.37
  @@ -109,7 +109,7 @@
    * DOMParser provides a parser which produces a W3C DOM tree as its output
    *
    * 
  - * @version $Id: DOMParser.java,v 1.36 2001/02/01 17:14:30 elena Exp $
  + * @version $Id: DOMParser.java,v 1.37 2001/02/01 21:45:46 lehors Exp $
    */
   public class DOMParser
       extends XMLParser
  @@ -926,7 +926,10 @@
                   Class docClass = Class.forName(documentClassName);
                   Class defaultDocClass = Class.forName(DEFAULT_DOCUMENT_CLASS_NAME);
                   if (isDocumentImpl) {
  -                    fDocument = new DocumentImpl(fGrammarAccess);
  +                    fDocumentImpl = new DocumentImpl(fGrammarAccess);
  +                    fDocument = fDocumentImpl;
  +                    // set DOM error checking off
  +                    fDocumentImpl.setErrorChecking(false);
                   }
                   else {
                       try {
  @@ -940,12 +943,6 @@
                           //          doesn't have a zero-arg constructor. -Ac
                       }
                   }
  -                if (docClass.isAssignableFrom(defaultDocClass)) {
  -                    // set DOM error checking off
  -                    fDocumentImpl = (DocumentImpl)fDocument;
  -                    fDocumentImpl.setErrorChecking(false);
  -                }
  -
                   fCurrentElementNode = fDocument;
               }
           }
  @@ -1411,12 +1408,6 @@
   
               fCurrentElementNode.appendChild(er);
               fCurrentElementNode = er;
  -            try {
  -                EntityReferenceImpl xer = (EntityReferenceImpl) er;
  -                xer.setReadOnly(false, false);
  -            } catch (Exception e) {
  -                // we aren't building against Xerces - do nothing
  -            }
           }
   
       } // startEntityReference(int,int,int)
  @@ -1494,10 +1485,8 @@
               Node erNode = fCurrentElementNode;//fCurrentElementNode.getParentNode();
               fCurrentElementNode = erNode.getParentNode();
   
  -            try {
  +            if (fDocumentImpl != null) {
                   EntityReferenceImpl xer = (EntityReferenceImpl) erNode;
  -                xer.setReadOnly(false, false);
  -
                   // if necessary populate the related entity now
                   if (fDocumentImpl != null) {
   
  @@ -1512,7 +1501,6 @@
                       }
   
                       EntityImpl entity = (EntityImpl) entityNode;
  -                    entity.setReadOnly(false, false);
                       for (Node child = erNode.getFirstChild();
                            child != null;
                            child = child.getNextSibling()) {
  @@ -1521,8 +1509,7 @@
                       }
                       entity.setReadOnly(true, true);
                   }
  -            } catch (Exception e) {
  -                // we aren't building against Xerces - do nothing
  +                xer.setReadOnly(true, true);
               }
           }
   
  
  
  

Mime
View raw message