You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@apache.org on 2001/10/01 11:55:33 UTC

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

andyc       01/10/01 02:55:33

  Modified:    java/docs releases.xml
               java/src/org/apache/xerces/impl XMLDTDScannerImpl.java
  Log:
  Fixed bug where the DTD scanner was reporting entity boundaries
  where not appropriate. For example, the use of the implied-space
  parameter entity in line 2 and 3 of the following:
  
  1:  <!ENTITY % implied-space ''>
  2:  <!ENTITY % parameter-entity '%implied-space;'>
  3:  <!ELEMENT%implied-space;elem (this|that)>
  
  Since the XNI handler does not break down the various markup
  declarations into the smallest granularity, reporting an entity
  boundary in the above cases is not useful to registered handlers.
  
  Revision  Changes    Path
  1.75      +9 -0      xml-xerces/java/docs/releases.xml
  
  Index: releases.xml
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/docs/releases.xml,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- releases.xml	2001/09/17 07:45:39	1.74
  +++ releases.xml	2001/10/01 09:55:33	1.75
  @@ -7,6 +7,15 @@
      XNI interfaces related to DTD information.
     </desc>
     <changes>
  +   <fix>
  +    <note>
  +     Fixed DTD scanner from reporting entity boundaries appearing
  +     inside of markup declarations. Entity boundaries appearing
  +     in the content model of an element declaration is still
  +     reported, though.
  +    </note>
  +    <submitter name='Andy Clark'/>
  +   </fix>
      <update>
       <note>
        Simplified XMLAttributes interface by removing the methods
  
  
  
  1.5       +21 -3     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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XMLDTDScannerImpl.java	2001/09/14 13:04:31	1.4
  +++ XMLDTDScannerImpl.java	2001/10/01 09:55:33	1.5
  @@ -102,7 +102,7 @@
    * @author Glenn Marcy, IBM
    * @author Eric Ye, IBM
    *
  - * @version $Id: XMLDTDScannerImpl.java,v 1.4 2001/09/14 13:04:31 andyc Exp $
  + * @version $Id: XMLDTDScannerImpl.java,v 1.5 2001/10/01 09:55:33 andyc Exp $
    */
   public class XMLDTDScannerImpl
       extends XMLScanner
  @@ -169,6 +169,9 @@
       /** Seen external parameter entity. */
       protected boolean fSeenExternalPE;
   
  +    /** Report entity boundary. */
  +    protected boolean fReportEntity;
  +
       // private data
   
       /** Start DTD called. */
  @@ -375,6 +378,8 @@
           fSeenExternalDTD = false;
           fSeenExternalPE = false;
   
  +        fReportEntity = true;
  +
           // set starting state
           setScannerState(SCANNER_STATE_TEXT_DECL);
   
  @@ -459,7 +464,7 @@
           }
   
           // call handler
  -        if (fDTDHandler != null) {
  +        if (fDTDHandler != null && fReportEntity) {
               fDTDHandler.startEntity(name, publicId, systemId, 
                                       baseSystemId, encoding);
           }
  @@ -476,7 +481,7 @@
           super.endEntity(name);
   
           // call handler
  -        if (fDTDHandler != null) {
  +        if (fDTDHandler != null && fReportEntity) {
               fDTDHandler.endEntity(name);
           }
   
  @@ -687,10 +692,12 @@
       protected final void scanElementDecl() throws IOException, XNIException {
   
           // spaces
  +        fReportEntity = false;
           if (!skipSeparator(true, !scanningInternalSubset())) {
               reportFatalError("MSG_SPACE_REQUIRED_BEFORE_ELEMENT_TYPE_IN_ELEMENTDECL",
                                null);
           }
  +        fReportEntity = true;
   
           // element name
           String name = fEntityScanner.scanName();
  @@ -752,7 +759,9 @@
               fDTDContentModelHandler.endContentModel();
           }
   
  +        fReportEntity = false;
           skipSeparator(false, !scanningInternalSubset());
  +        fReportEntity = true;
           // end
           if (!fEntityScanner.skipChar('>')) {
               reportFatalError("ElementDeclUnterminated", new Object[]{name});
  @@ -998,6 +1007,7 @@
       protected final void scanAttlistDecl() throws IOException, XNIException {
   
           // spaces
  +        fReportEntity = false;
           if (!skipSeparator(true, !scanningInternalSubset())) {
               reportFatalError("MSG_SPACE_REQUIRED_BEFORE_ELEMENT_TYPE_IN_ATTLISTDECL",
                                null);
  @@ -1080,6 +1090,7 @@
               fDTDHandler.endAttlist();
           }
           fMarkUpDepth--;
  +        fReportEntity = true;
   
       } // scanAttlistDecl()
   
  @@ -1268,6 +1279,7 @@
   
           boolean isPEDecl = false;
           boolean sawPERef = false;
  +        fReportEntity = false;
           if (fEntityScanner.skipSpaces()) {
               if (!fEntityScanner.skipChar('%')) {
                   isPEDecl = false; // <!ENTITY x "x">
  @@ -1418,6 +1430,7 @@
                   fDTDHandler.internalEntityDecl(name, fLiteral, fLiteral2); 
               }
           }
  +        fReportEntity = true;
   
       } // scanEntityDecl()
   
  @@ -1552,6 +1565,7 @@
       private final void scanNotationDecl() throws IOException, XNIException {
   
           // spaces
  +        fReportEntity = false;
           if (!skipSeparator(true, !scanningInternalSubset())) {
               reportFatalError("MSG_SPACE_REQUIRED_BEFORE_NOTATION_NAME_IN_NOTATIONDECL",
                                null);
  @@ -1593,6 +1607,7 @@
           if (fDTDHandler != null) {
               fDTDHandler.notationDecl(name, publicId, systemId);
           }
  +        fReportEntity = true;
   
       } // scanNotationDecl()
   
  @@ -1615,6 +1630,7 @@
       private final void scanConditionalSect()
           throws IOException, XNIException {
   
  +        fReportEntity = false;
           skipSeparator(false, !scanningInternalSubset());
           if (fEntityScanner.skipString("INCLUDE")) {
               skipSeparator(false, !scanningInternalSubset());
  @@ -1706,6 +1722,8 @@
           else {
               reportFatalError("MSG_MARKUP_NOT_RECOGNIZED_IN_DTD", null);
           }
  +        fReportEntity = true;
  +
       } // scanConditionalSect()
   
       /** 
  
  
  

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