You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by le...@apache.org on 2001/05/05 01:19:30 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl XMLDTDScanner.java

lehors      01/05/04 16:19:29

  Modified:    java/src/org/apache/xerces/impl Tag: xerces_j_2
                        XMLDTDScanner.java
  Log:
  fixed pull model in scanDTD and scanDTDInternalSubset
  removed bogus scanDTDFragment method.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.85  +27 -58    xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLDTDScanner.java
  
  Index: XMLDTDScanner.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLDTDScanner.java,v
  retrieving revision 1.1.2.84
  retrieving revision 1.1.2.85
  diff -u -r1.1.2.84 -r1.1.2.85
  --- XMLDTDScanner.java	2001/04/11 07:22:01	1.1.2.84
  +++ XMLDTDScanner.java	2001/05/04 23:19:26	1.1.2.85
  @@ -87,7 +87,7 @@
    * @author Glenn Marcy, IBM
    * @author Eric Ye, IBM
    *
  - * @version $Id: XMLDTDScanner.java,v 1.1.2.84 2001/04/11 07:22:01 andyc Exp $
  + * @version $Id: XMLDTDScanner.java,v 1.1.2.85 2001/05/04 23:19:26 lehors Exp $
    */
   public class XMLDTDScanner
       extends XMLScanner
  @@ -233,56 +233,21 @@
       public boolean scanDTD(boolean complete)
           throws IOException, SAXException {
   
  -        // set starting state
  -        setScannerState(SCANNER_STATE_TEXT_DECL);
  -
  -        fSeenExternalDTD = true;
  -
  -        scanTextDecl(complete);
  -
  -        if (fScannerState == SCANNER_STATE_END_OF_INPUT) {
  -            return false;
  -        }
  -
  -        // next state is markup decls regardless of whether there
  -        // is a TextDecl or not
  -        setScannerState(SCANNER_STATE_MARKUP_DECL);
  -
  -        // keep dispatching "events"
  -        while (complete) {
  -            if (!scanDecls(complete)) {
  +        if (fScannerState == SCANNER_STATE_TEXT_DECL) {
  +            fSeenExternalDTD = true;
  +            boolean more = scanTextDecl(complete);
  +            if (fScannerState == SCANNER_STATE_END_OF_INPUT) {
                   return false;
               }
  +            else if (!more || !complete) {
  +                return more;
  +            }
  +            else {
  +                // next state is markup decls regardless of whether there
  +                // is a TextDecl or not
  +                setScannerState(SCANNER_STATE_MARKUP_DECL);
  +            }
           }
  -
  -        // return that there is more to scan
  -        return true;
  -
  -    } // scanDTD
  -
  -    /**
  -     * scanDTDFragment
  -     * 
  -     * @param complete Whether to parse to completion or just a piece of it.
  -     * 
  -     * @return Whether there is more to parse or not.
  -     */
  -    public boolean scanDTDFragment(boolean complete)
  -        throws IOException, SAXException {
  -
  -        // set starting state
  -        setScannerState(SCANNER_STATE_TEXT_DECL);
  -
  -        scanTextDecl(complete);
  -
  -        if (fScannerState == SCANNER_STATE_END_OF_INPUT) {
  -            return false;
  -        }
  -
  -        // next state is markup decls regardless of whether there
  -        // is a TextDecl or not
  -        setScannerState(SCANNER_STATE_MARKUP_DECL);
  -
           // keep dispatching "events"
           do {
               if (!scanDecls(complete)) {
  @@ -293,7 +258,7 @@
           // return that there is more to scan
           return true;
   
  -    } // scanDTDFragment
  +    } // scanDTD
   
       /**
        * Scan an internal subset (starting after '[' and ending at ']').
  @@ -306,15 +271,15 @@
                                            boolean hasExtDTD)
           throws IOException, SAXException {
   
  -        // call handler
  -        if (fDTDHandler != null) {
  -            fDTDHandler.startDTD();
  -            fStartDTDCalled = true;
  +        if (fScannerState == SCANNER_STATE_TEXT_DECL) {
  +            // call handler
  +            if (fDTDHandler != null) {
  +                fDTDHandler.startDTD();
  +                fStartDTDCalled = true;
  +            }
  +            // set starting state for internal subset
  +            setScannerState(SCANNER_STATE_MARKUP_DECL);
           }
  -
  -        // set starting state
  -        setScannerState(SCANNER_STATE_MARKUP_DECL);
  -
           // keep dispatching "events"
           do {
               if (!scanDecls(complete)) {
  @@ -322,7 +287,8 @@
                   if (fDTDHandler != null && hasExtDTD == false) {
                       fDTDHandler.endDTD();
                   }
  -                // we're done
  +                // we're done, set starting state for external subset
  +                setScannerState(SCANNER_STATE_TEXT_DECL);
                   return false;
               }
           } while (complete);
  @@ -360,6 +326,9 @@
           fStandalone = false;
           fSeenExternalDTD = false;
           fSeenExternalPE = false;
  +
  +        // set starting state
  +        setScannerState(SCANNER_STATE_TEXT_DECL);
   
       } // reset
   
  
  
  

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