Andy Clark wrote:
> Could we change the code in the document scanner's
> DTDDispatcher to call setInputSource on the DTD scanner
> with an empty input source? 

In this case the document scanner never gets to the DTDDispatcher: the
DTD processing is skipped in the PrologDispatcher.

IMO, the change should go into PrologDispatcher and we can use same idea
you are proposing: call setInputSource(null) on the DTD scanner and
modify setInputSource so that in a case XMLInputSource is null, it
should send *dummy* start/endDTD calls (see attached diffs). That way
the entity manager won't barf..

Do you see any problems with this approach..?

-- 
Elena Litani / IBM Toronto
Index: XMLDTDScannerImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLDTDScannerImpl.java,v
retrieving revision 1.24
diff -u -r1.24 XMLDTDScannerImpl.java
--- XMLDTDScannerImpl.java      27 Jun 2002 21:23:08 -0000      1.24
+++ XMLDTDScannerImpl.java      26 Jul 2002 19:20:00 -0000
@@ -263,6 +263,12 @@
      * @throws IOException Thrown on i/o error.
      */
     public void setInputSource(XMLInputSource inputSource) throws IOException {
+        if (inputSource == null) {
+            // no system id was available
+            fDTDHandler.startDTD(null, null);
+            fDTDHandler.endDTD(null);
+            return;
+        }
         fEntityManager.setEntityHandler(this);
         fEntityManager.startDTDEntity(inputSource);
     } // setInputSource(XMLInputSource)
Index: XMLDocumentScannerImpl.java
===================================================================
RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentScannerImpl.java,v
retrieving revision 1.19
diff -u -r1.19 XMLDocumentScannerImpl.java
--- XMLDocumentScannerImpl.java 11 Jul 2002 14:37:31 -0000      1.19
+++ XMLDocumentScannerImpl.java 26 Jul 2002 19:18:45 -0000
@@ -713,6 +713,9 @@
                                 setDispatcher(fDTDDispatcher);
                                 return true;
                             }
+                            if (fDoctypeSystemId == null) {
+                                fDTDScanner.setInputSource(null);
+                            }
                             if (fDoctypeSystemId != null && ((fValidation || 
fLoadExternalDTD) 
                                     && (fValidationManager == null || 
!fValidationManager.isCachedDTD()))) {
                                 setScannerState(SCANNER_STATE_DTD_EXTERNAL);

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to