You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by je...@locus.apache.org on 2000/11/28 02:08:42 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes IDREFDatatypeValidator.java ListDatatypeValidator.java

jeffreyr    00/11/27 17:08:41

  Modified:    java/src/org/apache/xerces/impl Tag: xerces_j_2
                        XMLValidator.java
               java/src/org/apache/xerces/impl/validation/datatypes Tag:
                        xerces_j_2 IDREFDatatypeValidator.java
                        ListDatatypeValidator.java
  Log:
  fixed listdatatype to bubble up validation exception, fixed IDREF uniqueness message to pass id08,id09 conf. test
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.44  +7 -6      xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLValidator.java
  
  Index: XMLValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLValidator.java,v
  retrieving revision 1.1.2.43
  retrieving revision 1.1.2.44
  diff -u -r1.1.2.43 -r1.1.2.44
  --- XMLValidator.java	2000/11/28 00:15:45	1.1.2.43
  +++ XMLValidator.java	2000/11/28 01:08:34	1.1.2.44
  @@ -104,7 +104,7 @@
    * @author Andy Clark, IBM
    * @author Jeffrey Rodriguez IBM
    *
  - * @version $Id: XMLValidator.java,v 1.1.2.43 2000/11/28 00:15:45 jeffreyr Exp $
  + * @version $Id: XMLValidator.java,v 1.1.2.44 2000/11/28 01:08:34 jeffreyr Exp $
    */
   public class XMLValidator
   implements XMLComponent, 
  @@ -770,11 +770,12 @@
                       fValIDRef.validate();//Do final validation of IDREFS against IDs
                       fValIDRefs.validate();
                   } catch (InvalidDatatypeValueException ex) {
  -                    fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, 
  -                                               "IDNotUnique",
  -                                               new Object[]{ null, 
  -                                                   ex.getMessage()},
  -                                               XMLErrorReporter.SEVERITY_ERROR);
  +                String  key = ex.getKeyIntoReporter();
  +
  +                fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,
  +                                            key,
  +                                            new Object[]{ ex.getMessage()},
  +                                            XMLErrorReporter.SEVERITY_ERROR );
                   }
               }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.9   +3 -1      xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/Attic/IDREFDatatypeValidator.java
  
  Index: IDREFDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/Attic/IDREFDatatypeValidator.java,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- IDREFDatatypeValidator.java	2000/11/28 00:16:01	1.1.2.8
  +++ IDREFDatatypeValidator.java	2000/11/28 01:08:36	1.1.2.9
  @@ -104,7 +104,7 @@
    * </CODE>
    * 
    * @author Jeffrey Rodriguez-
  - * @version $Id: IDREFDatatypeValidator.java,v 1.1.2.8 2000/11/28 00:16:01 jeffreyr Exp $
  + * @version $Id: IDREFDatatypeValidator.java,v 1.1.2.9 2000/11/28 01:08:36 jeffreyr Exp $
    * @see org.apache.xerces.impl.validation.datatypes.IDDatatypeValidator
    * @see org.apache.xerces.impl.validation.datatypes.AbstractDatatypeValidator
    * @see org.apache.xerces.impl.validation.DatatypeValidator
  @@ -269,6 +269,7 @@
       * @exception InvalidDatatypeValueException
       */
      private void checkIdRefs() throws InvalidDatatypeValueException {
  +
         if ( fTableIDRefs == null)
            return;
   
  @@ -280,6 +281,7 @@
   
               InvalidDatatypeValueException error =  new
                                                      InvalidDatatypeValueException( key );
  +            error.setKeyIntoReporter("MSG_ELEMENT_WITH_ID_REQUIRED" );
               throw error;
            }
         }
  
  
  
  1.1.2.3   +16 -10    xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/Attic/ListDatatypeValidator.java
  
  Index: ListDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/Attic/ListDatatypeValidator.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- ListDatatypeValidator.java	2000/11/03 01:34:20	1.1.2.2
  +++ ListDatatypeValidator.java	2000/11/28 01:08:37	1.1.2.3
  @@ -266,17 +266,23 @@
                       throw new InvalidDatatypeValueException("Value '"+
                                                               content+"' must be one of "+fEnumeration);
               }
  -
  -            if (this.fDerivedByList) {
  -                while (parsedList.hasMoreTokens()) {       //Check each token in list against base type
  +            try {
  +                if (this.fDerivedByList) {
  +                    while (parsedList.hasMoreTokens()) {       //Check each token in list against base type
  +                        if (this.fBaseValidator != null) {//validate against parent type if any
  +                            this.fBaseValidator.validate( parsedList.nextToken(), state );
  +                        }
  +                    }
  +                } else {
                       if (this.fBaseValidator != null) {//validate against parent type if any
  -                        this.fBaseValidator.validate( parsedList.nextToken(), state );
  +                        this.fBaseValidator.validate( content, state );
                       }
  -                }
  -            } else {
  -                if (this.fBaseValidator != null) {//validate against parent type if any
  -                    this.fBaseValidator.validate( content, state );
                   }
  +            } catch (InvalidDatatypeValueException ex) { //Keep bubbling up exception but change content to list content
  +                                                         //Unfortunately we need to throw a new Exception
  +                InvalidDatatypeValueException error = new InvalidDatatypeValueException( content );//Need Message
  +                error.setKeyIntoReporter( ex.getKeyIntoReporter() );
  +                throw error;//type message repacked with the List content message
               }
   
           } catch (NoSuchElementException e) {
  @@ -296,7 +302,7 @@
        * @param documentInstanceState
        */
       public void initialize( Object documentInstanceState ) {
  -        if (fBaseValidator instanceof StatefullDatatypeValidator ){
  +        if (fBaseValidator instanceof StatefullDatatypeValidator) {
               ((StatefullDatatypeValidator)fBaseValidator).initialize( documentInstanceState ); 
           }
       }
  @@ -321,7 +327,7 @@
       public Object getInternalStateInformation() {
           Object value = null;
           if (fBaseValidator instanceof 
  -           org.apache.xerces.impl.validation.datatypes.IDDatatypeValidator ) {
  +            org.apache.xerces.impl.validation.datatypes.IDDatatypeValidator) {
               value = ((StatefullDatatypeValidator)fBaseValidator).getInternalStateInformation();
           }
           return value;