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/02 21:35:14 UTC

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

elena       02/01/02 12:35:14

  Modified:    java/src/org/apache/xerces/impl XMLDTDScannerImpl.java
  Log:
  Bug fix http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5122
  
  Revision  Changes    Path
  1.12      +26 -6     xml-xerces/java/src/org/apache/xerces/impl/XMLDTDScannerImpl.java
  
  Index: XMLDTDScannerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLDTDScannerImpl.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- XMLDTDScannerImpl.java	14 Dec 2001 20:48:32 -0000	1.11
  +++ XMLDTDScannerImpl.java	2 Jan 2002 20:35:14 -0000	1.12
  @@ -102,7 +102,7 @@
    * @author Glenn Marcy, IBM
    * @author Eric Ye, IBM
    *
  - * @version $Id: XMLDTDScannerImpl.java,v 1.11 2001/12/14 20:48:32 lmartin Exp $
  + * @version $Id: XMLDTDScannerImpl.java,v 1.12 2002/01/02 20:35:14 elena Exp $
    */
   public class XMLDTDScannerImpl
       extends XMLScanner
  @@ -192,6 +192,10 @@
       /** Parameter entity stack to check well-formedness. */
       private int[] fPEStack = new int[5];
   
  +
  +    /** Parameter entity stack to report start/end entity calls. */
  +    private boolean[] fPEReport = new boolean[5];
  +
       /** Number of opened parameter entities. */
       private int fPEDepth;
   
  @@ -457,7 +461,7 @@
               fExtEntityDepth++;
           }
           else if (name.charAt(0) == '%') {
  -            pushPEStack(fMarkUpDepth);
  +            pushPEStack(fMarkUpDepth, fReportEntity);
               if (fEntityScanner.isExternal()) {
                   fExtEntityDepth++;
               }
  @@ -483,6 +487,7 @@
           // Handle end of PE
           boolean reportEntity = fReportEntity;
           if (name.startsWith("%")) {
  +            reportEntity = peekReportEntity();
               // check well-formedness of the enity
               int startMarkUpDepth = popPEStack();
               if (startMarkUpDepth != fMarkUpDepth) {
  @@ -1649,18 +1654,21 @@
   
           fReportEntity = false;
           skipSeparator(false, !scanningInternalSubset());
  +
           if (fEntityScanner.skipString("INCLUDE")) {
               skipSeparator(false, !scanningInternalSubset());
               // call handler
  +            if (!fEntityScanner.skipChar('[')) {
  +                reportFatalError("MSG_MARKUP_NOT_RECOGNIZED_IN_DTD", null);
  +            }
  +
               if (fDTDHandler != null) {
                   fDTDHandler.startConditional(
                                               XMLDTDHandler.CONDITIONAL_INCLUDE);
               }
  -            if (!fEntityScanner.skipChar('[')) {
  -                reportFatalError("MSG_MARKUP_NOT_RECOGNIZED_IN_DTD", null);
  -            }
               fIncludeSectDepth++;
               // just stop there and go back to the main loop
  +            fReportEntity = true;
           }
           else if (fEntityScanner.skipString("IGNORE")) {
               skipSeparator(false, !scanningInternalSubset());
  @@ -1901,17 +1909,29 @@
       /*
        * Parameter Entity Stack
        */
  -    private final void pushPEStack(int depth) {
  +    private final void pushPEStack(int depth, boolean report) {
           if (fPEStack.length == fPEDepth) {
               int[] newIntStack = new int[fPEDepth * 2];
               System.arraycopy(fPEStack, 0, newIntStack, 0, fPEDepth);
               fPEStack = newIntStack;
  +            // report end/start calls
  +            boolean[] newBooleanStack = new boolean[fPEDepth * 2];
  +            System.arraycopy(fPEReport, 0, newBooleanStack, 0, fPEDepth);
  +            fPEReport = newBooleanStack;
  +
           }
  +        fPEReport[fPEDepth] = report;
           fPEStack[fPEDepth++] = depth;
       }
   
  +    /** pop the stack */
       private final int popPEStack() {
           return fPEStack[--fPEDepth];
  +    }
  +
  +    /** look at the top of the stack */
  +    private final boolean peekReportEntity() {
  +        return fPEReport[fPEDepth-1];
       }
   
   
  
  
  

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