xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From el...@apache.org
Subject cvs commit: xml-xerces/java/src/org/apache/xerces/validators/common XMLValidator.java
Date Wed, 21 Feb 2001 19:05:43 GMT
elena       01/02/21 11:05:42

  Modified:    java/src/org/apache/xerces/validators/common
                        XMLValidator.java
  Log:
  We were trying to validate IDREF/IDREFs when validation is OFF.
  Fixed that.
  
  Revision  Changes    Path
  1.123     +27 -25    xml-xerces/java/src/org/apache/xerces/validators/common/XMLValidator.java
  
  Index: XMLValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/common/XMLValidator.java,v
  retrieving revision 1.122
  retrieving revision 1.123
  diff -u -r1.122 -r1.123
  --- XMLValidator.java	2001/02/21 09:57:15	1.122
  +++ XMLValidator.java	2001/02/21 19:05:37	1.123
  @@ -121,7 +121,7 @@
   /**
    * This class is the super all-in-one validator used by the parser.
    *
  - * @version $Id: XMLValidator.java,v 1.122 2001/02/21 09:57:15 andyc Exp $
  + * @version $Id: XMLValidator.java,v 1.123 2001/02/21 19:05:37 elena Exp $
    */
   public final class XMLValidator
       implements DefaultEntityHandler.EventHandler,
  @@ -346,7 +346,7 @@
      private boolean fNeedValidationOff = false;
   
      //Schema Normalization
  -    private boolean DEBUG_NORMALIZATION = false;
  +    private static final boolean DEBUG_NORMALIZATION = false;
       private DatatypeValidator fCurrentDV = null; //current datatype validator
       private boolean fFirstChunk = true; // got first chunk in characters() (SAX)
       private boolean fTrailing = false;  // Previous chunk had a trailing space
  @@ -1406,8 +1406,7 @@
            if (fValidating ) {
               try {
                       this.fValIDRef.validate( null, this.fValidateIDRef ); //Do final IDREF
validation round  
  -               this.fValIDRefs.validate( null, this.fValidateIDRef );
  -
  +                    this.fValIDRefs.validate( null, this.fValidateIDRef );
                       this.fValID.validate( null, this.fResetID );//Reset ID, IDREF, IDREFS
validators here
                       this.fValIDRef.validate(null, this.fResetIDRef );
                       this.fValIDRefs.validate(null, this.fResetID );
  @@ -1415,8 +1414,8 @@
               } catch ( InvalidDatatypeValueException ex ) {
                  reportRecoverableXMLError( ex.getMajorCode(), ex.getMinorCode(), 
                                             ex.getMessage() ); 
  -                }
               }
  +         }
            return;
         }
   
  @@ -1837,15 +1836,14 @@
   
      /** Reset pool. */
      private void poolReset() {
  -        //System.out.println("We reset" );
           if (fValidating) { // - el
  -      try {
  -         this.fValID.validate( null, this.fResetID );
  -         this.fValIDRef.validate(null, this.fResetIDRef );
  -         this.fValIDRefs.validate(null, this.fResetIDRef );
  +            try {
  +                this.fValID.validate( null, this.fResetID );
  +                this.fValIDRef.validate(null, this.fResetIDRef );
  +                this.fValIDRefs.validate(null, this.fResetIDRef );
               } catch (InvalidDatatypeValueException ex) { //should use error reporter
  -         System.err.println("Error re-Initializing: ID,IDRef,IDRefs pools" );
  -      }
  +                System.err.println("Error re-Initializing: ID,IDRef,IDRefs pools" );
  +            }
           }
      } // poolReset()
   
  @@ -2073,7 +2071,7 @@
                                                XMLErrorReporter.ERRORTYPE_RECOVERABLE_ERROR);
                  }
               } else if (attValue != -1) {
  -               if (validationEnabled && standalone )
  +               if (validationEnabled && standalone ) {
                     if ( fGrammarIsDTDGrammar 
                          && ((DTDGrammar) fGrammar).getAttributeDeclIsExternal(attlistIndex)
) {
   
  @@ -2086,11 +2084,14 @@
                                                   args,
                                                   XMLErrorReporter.ERRORTYPE_RECOVERABLE_ERROR);
                     }
  -               if (attType == fIDREFSymbol) {
  -                  this.fValIDRef.validate( fStringPool.toString(attValue), this.fStoreIDRef
);
  -               } else if (attType == fIDREFSSymbol) {
  -                  this.fValIDRefs.validate( fStringPool.toString(attValue), this.fStoreIDRef
);
                  }
  +               if (validationEnabled) {
  +                   if (attType == fIDREFSymbol) {
  +                       this.fValIDRef.validate( fStringPool.toString(attValue), this.fStoreIDRef
);
  +                   } else if (attType == fIDREFSSymbol) {
  +                       this.fValIDRefs.validate( fStringPool.toString(attValue), this.fStoreIDRef
);
  +                   }
  +               }
                  if (attrIndex == -1) {
                     attrIndex = attrList.startAttrList();
                  }
  @@ -2220,7 +2221,7 @@
                                                XMLErrorReporter.ERRORTYPE_RECOVERABLE_ERROR);
                  }
               } else if (attValue != -1) {
  -               if (validationEnabled && standalone )
  +               if (validationEnabled && standalone ){
                     if ( fGrammarIsDTDGrammar 
                          && ((DTDGrammar) fGrammar).getAttributeDeclIsExternal(attlistIndex)
) {
   
  @@ -2233,11 +2234,15 @@
                                                   args,
                                                   XMLErrorReporter.ERRORTYPE_RECOVERABLE_ERROR);
                     }
  -               if (attType == fIDREFSymbol) {
  -                  this.fValIDRef.validate( fStringPool.toString(attValue), this.fStoreIDRef
);
  -               } else if (attType == fIDREFSSymbol) {
  -                  this.fValIDRefs.validate( fStringPool.toString(attValue), this.fStoreIDRef
);
                  }
  +               if (validationEnabled) {
  +                    if (attType == fIDREFSymbol) {
  +                        this.fValIDRef.validate( fStringPool.toString(attValue), this.fStoreIDRef
);
  +                    }
  +                    else if (attType == fIDREFSSymbol) {
  +                        this.fValIDRefs.validate( fStringPool.toString(attValue), this.fStoreIDRef
);
  +                    }
  +               }
                  if (attrIndex == -1) {
                     attrIndex = attrList.startAttrList();
                  }
  @@ -3504,9 +3509,6 @@
                  }
               }
               try {
  -               //this.fIdDefs = (Hashtable) fValID.validate( value, null );
  -               //System.out.println("this.fIdDefs = " + this.fIdDefs );
  -
                  this.fStoreIDRef.setDatatypeObject( fValID.validate( value, null ) );
                  fValIDRef.validate( value, this.fStoreIDRef ); //just in case we called
id after IDREF
               } catch ( InvalidDatatypeValueException ex ) {
  
  
  

Mime
View raw message