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/10/17 02:52:42 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/validators/datatype ListDatatypeValidator.java BinaryDatatypeValidator.java BooleanDatatypeValidator.java DatatypeValidatorFactoryImpl.java DecimalDatatypeValidator.java DoubleDatatypeValidator.java ENTITYDatatypeValidator.java FloatDatatypeValidator.java IDDatatypeValidator.java IDREFDatatypeValidator.java Makefile NOTATIONDatatypeValidator.java QNameDatatypeValidator.java RecurringDurationDatatypeValidator.java StringDatatypeValidator.java TimeDurationDatatypeValidator.java URIReferenceDatatypeValidator.java

jeffreyr    00/10/16 17:52:42

  Modified:    java/src/org/apache/xerces/validators/datatype
                        BinaryDatatypeValidator.java
                        BooleanDatatypeValidator.java
                        DatatypeValidatorFactoryImpl.java
                        DecimalDatatypeValidator.java
                        DoubleDatatypeValidator.java
                        ENTITYDatatypeValidator.java
                        FloatDatatypeValidator.java
                        IDDatatypeValidator.java
                        IDREFDatatypeValidator.java Makefile
                        NOTATIONDatatypeValidator.java
                        QNameDatatypeValidator.java
                        RecurringDurationDatatypeValidator.java
                        StringDatatypeValidator.java
                        TimeDurationDatatypeValidator.java
                        URIReferenceDatatypeValidator.java
  Added:       java/src/org/apache/xerces/validators/datatype
                        ListDatatypeValidator.java
  Log:
  Added List datatype refactoring
  
  Revision  Changes    Path
  1.7       +71 -78    xml-xerces/java/src/org/apache/xerces/validators/datatype/BinaryDatatypeValidator.java
  
  Index: BinaryDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/BinaryDatatypeValidator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BinaryDatatypeValidator.java	2000/08/02 02:57:47	1.6
  +++ BinaryDatatypeValidator.java	2000/10/17 00:52:38	1.7
  @@ -73,7 +73,8 @@
    *
    * @author Ted Leung
    * @author Jeffrey Rodriguez
  - * @version $Id: BinaryDatatypeValidator.java,v 1.6 2000/08/02 02:57:47 jeffreyr Exp $
  + * @author Mark Swinkles - List Validation refactoring
  + * @version $Id: BinaryDatatypeValidator.java,v 1.7 2000/10/17 00:52:38 jeffreyr Exp $
    */
   
   public class BinaryDatatypeValidator extends AbstractDatatypeValidator {
  @@ -85,7 +86,6 @@
       private Vector             fEnumeration     = null;
       private int                fFacetsDefined   = 0;
       private String             fEncoding        = SchemaSymbols.ATTVAL_BASE64;//default Base64 encoding
  -    private boolean            fDerivedByList   = false; // Default is restriction 
   
       public BinaryDatatypeValidator () throws InvalidDatatypeFacetException {
           this( null, null, false ); // Native, No Facets defined, Restriction
  @@ -96,74 +96,70 @@
           if ( base != null )
               setBasetype( base ); // Set base type 
   
  -        fDerivedByList = derivedByList;
   
           // Set Facets if any defined
   
           if ( facets != null  )  {
  -            if ( fDerivedByList == false ) {
  -                for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  -                    String key = (String) e.nextElement();
  -                    if ( key.equals(SchemaSymbols.ELT_LENGTH ) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_LENGTH;
  -                        String lengthValue = (String)facets.get(key);
  -                        try {
  -                            fLength     = Integer.parseInt( lengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("Length value '"+
  -                                                                    lengthValue+"' is invalid.");
  -                        }
  -                        if ( fLength < 0 )
  -                            throw new InvalidDatatypeFacetException("Length value '"+
  -                                                                    lengthValue+"'  must be a nonNegativeInteger.");
  -
  -                    } else if (key.equals(SchemaSymbols.ELT_MINLENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MINLENGTH;
  -                        String minLengthValue = (String)facets.get(key);
  -                        try {
  -                            fMinLength     = Integer.parseInt( minLengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("maxLength value '"+minLengthValue+"' is invalid.");
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXLENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXLENGTH;
  -                        String maxLengthValue = (String)facets.get(key);
  -                        try {
  -                            fMaxLength     = Integer.parseInt( maxLengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("maxLength value '"+maxLengthValue+"' is invalid.");
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  -                        fPattern = (String)facets.get(key);
  -                    } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  -                        fEnumeration = (Vector)facets.get(key);
  -                    } else if (key.equals(SchemaSymbols.ELT_ENCODING )) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  -                        fEncoding = (String)facets.get(key);
  -                    } else {
  -                        throw new InvalidDatatypeFacetException();
  +            for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  +                String key = (String) e.nextElement();
  +                if ( key.equals(SchemaSymbols.ELT_LENGTH ) ) {
  +                    fFacetsDefined += DatatypeValidator.FACET_LENGTH;
  +                    String lengthValue = (String)facets.get(key);
  +                    try {
  +                        fLength     = Integer.parseInt( lengthValue );
  +                    } catch (NumberFormatException nfe) {
  +                        throw new InvalidDatatypeFacetException("Length value '"+
  +                                                                lengthValue+"' is invalid.");
                       }
  -                }
  -                if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
  -                    if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "It is an error for both length and maxLength to be members of facets." );  
  -                    } else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "It is an error for both length and minLength to be members of facets." );
  +                    if ( fLength < 0 )
  +                        throw new InvalidDatatypeFacetException("Length value '"+
  +                                                                lengthValue+"'  must be a nonNegativeInteger.");
  +
  +                } else if (key.equals(SchemaSymbols.ELT_MINLENGTH) ) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MINLENGTH;
  +                    String minLengthValue = (String)facets.get(key);
  +                    try {
  +                        fMinLength     = Integer.parseInt( minLengthValue );
  +                    } catch (NumberFormatException nfe) {
  +                        throw new InvalidDatatypeFacetException("maxLength value '"+minLengthValue+"' is invalid.");
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_MAXLENGTH) ) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXLENGTH;
  +                    String maxLengthValue = (String)facets.get(key);
  +                    try {
  +                        fMaxLength     = Integer.parseInt( maxLengthValue );
  +                    } catch (NumberFormatException nfe) {
  +                        throw new InvalidDatatypeFacetException("maxLength value '"+maxLengthValue+"' is invalid.");
                       }
  +                } else if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  +                    fPattern = (String)facets.get(key);
  +                } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  +                    fEnumeration = (Vector)facets.get(key);
  +                } else if (key.equals(SchemaSymbols.ELT_ENCODING )) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  +                    fEncoding = (String)facets.get(key);
  +                } else {
  +                    throw new InvalidDatatypeFacetException();
  +                }
  +            }
  +            if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
  +                if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
  +                    throw new InvalidDatatypeFacetException(
  +                                                            "It is an error for both length and maxLength to be members of facets." );  
  +                } else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
  +                    throw new InvalidDatatypeFacetException(
  +                                                            "It is an error for both length and minLength to be members of facets." );
                   }
  +            }
   
  -                if ( ( (fFacetsDefined & ( DatatypeValidator.FACET_MINLENGTH |
  -                                           DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
  -                    if ( fMinLength > fMaxLength ) {
  -                        throw new InvalidDatatypeFacetException( "Value of maxLength = " + fMaxLength +
  -                                                                 "must be greater that the value of minLength" + fMinLength );
  -                    }
  +            if ( ( (fFacetsDefined & ( DatatypeValidator.FACET_MINLENGTH |
  +                                        DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
  +                if ( fMinLength > fMaxLength ) {
  +                    throw new InvalidDatatypeFacetException( "Value of maxLength = " + fMaxLength +
  +                                                                "must be greater that the value of minLength" + fMinLength );
                   }
  -            } else {  //Derivation by List 
               }
           }// End of Facet setting
       }
  @@ -183,25 +179,22 @@
        */
       public Object validate(String content, Object state ) throws InvalidDatatypeValueException {
   
  -        if ( fDerivedByList == false) { //derived by restriction
  -            if ( this.fBaseValidator != null ) {//validate against parent type if any
  -                this.fBaseValidator.validate( content, state );
  -            }
  -
  -            if (((fFacetsDefined & DatatypeValidator.FACET_ENCODING) != 0 ) ){ //Encode defined then validate
  -                if ( fEncoding.equals( SchemaSymbols.ATTVAL_BASE64)){ //Base64
  -                    if ( Base64.isBase64( content ) == false ) {
  -                        throw new InvalidDatatypeValueException( "Value '"+
  -                                                                 content+ "'  must be" + "is not encoded in Base64" );
  -                    }
  -                } else { //HexBin
  -                    if ( HexBin.isHex( content ) == false ){
  -                        throw new InvalidDatatypeValueException( "Value '"+
  -                                                                 content+ "'  must be" + "is not encoded in Hex" );
  -                    }
  +        if ( this.fBaseValidator != null ) {//validate against parent type if any
  +            this.fBaseValidator.validate( content, state );
  +        }
  +
  +        if (((fFacetsDefined & DatatypeValidator.FACET_ENCODING) != 0 ) ){ //Encode defined then validate
  +            if ( fEncoding.equals( SchemaSymbols.ATTVAL_BASE64)){ //Base64
  +                if ( Base64.isBase64( content ) == false ) {
  +                    throw new InvalidDatatypeValueException( "Value '"+
  +                                                                content+ "'  must be" + "is not encoded in Base64" );
  +                }
  +            } else { //HexBin
  +                if ( HexBin.isHex( content ) == false ){
  +                    throw new InvalidDatatypeValueException( "Value '"+
  +                                                                content+ "'  must be" + "is not encoded in Hex" );
                   }
               }
  -        } else{ //derived by list - What does it mean for binary types?
           }
           return null;
       }
  
  
  
  1.5       +3 -9      xml-xerces/java/src/org/apache/xerces/validators/datatype/BooleanDatatypeValidator.java
  
  Index: BooleanDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/BooleanDatatypeValidator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BooleanDatatypeValidator.java	2000/06/23 01:26:29	1.4
  +++ BooleanDatatypeValidator.java	2000/10/17 00:52:38	1.5
  @@ -70,7 +70,8 @@
    *
    * @author Ted Leung 
    * @author Jeffrey Rodriguez
  - * @version  $Id: BooleanDatatypeValidator.java,v 1.4 2000/06/23 01:26:29 jeffreyr Exp $
  + * @author Mark Swinkles - List Validation refactoring
  + * @version  $Id: BooleanDatatypeValidator.java,v 1.5 2000/10/17 00:52:38 jeffreyr Exp $
    */
   
   public class BooleanDatatypeValidator extends AbstractDatatypeValidator {
  @@ -80,7 +81,6 @@
       private int                     fFacetsDefined   = 0;
       private DatatypeMessageProvider fMessageProvider = new DatatypeMessageProvider();
       private static  final String    fValueSpace[]    = { "false", "true", "0", "1"};
  -    private boolean                 fDerivedByList   = false;
       private RegularExpression       fRegex           = null;
   
       public BooleanDatatypeValidator () throws InvalidDatatypeFacetException {
  @@ -91,8 +91,6 @@
                    boolean derivedByList ) throws InvalidDatatypeFacetException {
           setBasetype( base ); // Set base type 
   
  -        fDerivedByList = derivedByList;
  -
           // Set Facets if any defined
           if ( facets != null  ) { 
               if ( derivedByList == false ) {
  @@ -127,11 +125,7 @@
   
       public Object validate(String content, Object state) throws InvalidDatatypeValueException {
   
  -        if ( fDerivedByList == true ) {
  -            ;// What does it mean?
  -        } else {
  -            checkContent( content );
  -        }
  +        checkContent( content );
           return null;
       }
   
  
  
  
  1.12      +27 -21    xml-xerces/java/src/org/apache/xerces/validators/datatype/DatatypeValidatorFactoryImpl.java
  
  Index: DatatypeValidatorFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/DatatypeValidatorFactoryImpl.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DatatypeValidatorFactoryImpl.java	2000/07/11 19:59:08	1.11
  +++ DatatypeValidatorFactoryImpl.java	2000/10/17 00:52:38	1.12
  @@ -67,8 +67,9 @@
   
   
   /**
  - * @version $Id: DatatypeValidatorFactoryImpl.java,v 1.11 2000/07/11 19:59:08 ericye Exp $
  + * @version $Id: DatatypeValidatorFactoryImpl.java,v 1.12 2000/10/17 00:52:38 jeffreyr Exp $
    * @author  Jeffrey Rodriguez
  + * @author Mark Swinkles - List Validation refactoring
    */
   
   public class DatatypeValidatorFactoryImpl implements DatatypeValidatorFactory {
  @@ -268,39 +269,44 @@
           }
   
           if ( base != null ) {
  -            try {
  -                Class validatorDef = base.getClass();
  -
  -                Class [] validatorArgsClass = new Class[] {  
  -                    org.apache.xerces.validators.datatype.DatatypeValidator.class,
  -                    java.util.Hashtable.class,
  -                    boolean.class};
  +            if (list)
  +            {
  +                simpleType = new ListDatatypeValidator(base, facets, list);    
  +            }
  +            else
  +            {
  +                try {
  +                    Class validatorDef = base.getClass();
   
  +                    Class [] validatorArgsClass = new Class[] {  
  +                        org.apache.xerces.validators.datatype.DatatypeValidator.class,
  +                        java.util.Hashtable.class,
  +                        boolean.class};
   
   
  -                Object [] validatorArgs     = new Object[] {
  -                    base, facets, new Boolean( list )};
   
  +                    Object [] validatorArgs     = new Object[] {
  +                        base, facets, Boolean.FALSE };
   
   
   
  -                Constructor validatorConstructor =
  -                validatorDef.getConstructor( validatorArgsClass );
   
  +                    Constructor validatorConstructor =
  +                    validatorDef.getConstructor( validatorArgsClass );
   
  -                simpleType = 
  -                ( DatatypeValidator ) createDatatypeValidator (
  -                                                 validatorConstructor, validatorArgs );
   
  -                if (simpleType != null) {
  -                    addValidator( typeName, simpleType );//register validator
  +                    simpleType = 
  +                    ( DatatypeValidator ) createDatatypeValidator (
  +                                                    validatorConstructor, validatorArgs );
  +                } catch (NoSuchMethodException e) {
  +                    e.printStackTrace();
                   }
  -
  -
  -            } catch (NoSuchMethodException e) {
  -                e.printStackTrace();
               }
   
  +            if (simpleType != null) {
  +                addValidator( typeName, simpleType );//register validator
  +            }
  +            
           }
           return simpleType;// return it
       }
  
  
  
  1.15      +155 -169  xml-xerces/java/src/org/apache/xerces/validators/datatype/DecimalDatatypeValidator.java
  
  Index: DecimalDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/DecimalDatatypeValidator.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DecimalDatatypeValidator.java	2000/09/15 00:56:06	1.14
  +++ DecimalDatatypeValidator.java	2000/10/17 00:52:38	1.15
  @@ -73,13 +73,13 @@
    *
    * @author Ted Leung
    * @author Jeffrey Rodriguez
  - * @version $Id: DecimalDatatypeValidator.java,v 1.14 2000/09/15 00:56:06 jeffreyr Exp $
  + * @author Mark Swinkles - List Validation refactoring
  + * @version $Id: DecimalDatatypeValidator.java,v 1.15 2000/10/17 00:52:38 jeffreyr Exp $
    */
   
   public class DecimalDatatypeValidator extends AbstractDatatypeValidator {
       private Locale            fLocale           = null;
       private DatatypeValidator fBaseValidator    = null; // Null means a native datatype
  -    private boolean           fDerivedByList    = false; //Derived by restriction is defaul
       private BigDecimal[]      fEnumDecimal      = null;
       private String            fPattern          = null;
       private BigDecimal        fMaxInclusive     = null;
  @@ -110,145 +110,138 @@
           setBasetype( base ); // Set base type 
   
   
  -        fDerivedByList = derivedByList;
  -
           if ( facets != null ) {   // Set Facet
               //fFacets = facets;
               fFacets = checkForFacetConsistency( facets, base.getFacets() );// Check the current facets against base facets
   
               fFacets = facets;
  -            if ( fDerivedByList == false ) { // Derivation by Constraint 
  -                //if( base != null ) 
  -                //  System.out.println("facets = " + base.getFacets() ); 
  -
  -                Vector enumeration = null;
  -                String value       = null;
  -                for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  -                    String key   = (String) e.nextElement();
  -                    try {
  -                        if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  -                            value = ((String) facets.get(key ));
  -                            fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  -                            fPattern        = value;
  -                            if ( fPattern != null )
  -                                fRegex = new RegularExpression(fPattern, "X" );
  -                        } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  -                            fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  -                            enumeration     = (Vector)facets.get(key);
  -                        } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
  -                            value = ((String) facets.get(key ));
  -                            fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  -                            fMaxInclusive    = new BigDecimal(stripPlusIfPresent(value));
  -                        } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
  -                            value = ((String) facets.get(key ));
  -                            fFacetsDefined += DatatypeValidator.FACET_MAXEXCLUSIVE;
  -                            fMaxExclusive   = new BigDecimal(stripPlusIfPresent( value));
  -                        } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) {
  -                            value = ((String) facets.get(key ));
  -                            fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  -                            fMinInclusive   = new BigDecimal(stripPlusIfPresent(value));
  -                        } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
  -                            value = ((String) facets.get(key ));
  -                            fFacetsDefined += DatatypeValidator.FACET_MINEXCLUSIVE;
  -                            fMinExclusive   = new BigDecimal(stripPlusIfPresent(value));
  -                        } else if (key.equals(SchemaSymbols.ELT_PRECISION)) {
  -                            value = ((String) facets.get(key ));
  -                            fFacetsDefined += DatatypeValidator.FACET_PRECISSION;
  -                            isPrecisionDefined = true;
  -                            fPrecision      = Integer.parseInt(value );
  -                        } else if (key.equals(SchemaSymbols.ELT_SCALE)) {
  -                            value = ((String) facets.get(key ));
  -                            fFacetsDefined += DatatypeValidator.FACET_SCALE;
  -                            isScaleDefined  = true;
  -                            fScale          = Integer.parseInt( value );
  -                        } else {
  -                            throw new InvalidDatatypeFacetException(
  -                                                                   getErrorString( DatatypeMessageProvider.MSG_FORMAT_FAILURE,
  -                                                                                   DatatypeMessageProvider.MSG_NONE, null));
  -                        }
  -                    } catch ( Exception ex ){
  -                        throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                               DatatypeMessageProvider.IllegalFacetValue, 
  -                                                                               DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
  +
  +            Vector enumeration = null;
  +            String value       = null;
  +            for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  +                String key   = (String) e.nextElement();
  +                try {
  +                    if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  +                        value = ((String) facets.get(key ));
  +                        fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  +                        fPattern        = value;
  +                        if ( fPattern != null )
  +                            fRegex = new RegularExpression(fPattern, "X" );
  +                    } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  +                        fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  +                        enumeration     = (Vector)facets.get(key);
  +                    } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
  +                        value = ((String) facets.get(key ));
  +                        fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  +                        fMaxInclusive    = new BigDecimal(stripPlusIfPresent(value));
  +                    } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
  +                        value = ((String) facets.get(key ));
  +                        fFacetsDefined += DatatypeValidator.FACET_MAXEXCLUSIVE;
  +                        fMaxExclusive   = new BigDecimal(stripPlusIfPresent( value));
  +                    } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) {
  +                        value = ((String) facets.get(key ));
  +                        fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  +                        fMinInclusive   = new BigDecimal(stripPlusIfPresent(value));
  +                    } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
  +                        value = ((String) facets.get(key ));
  +                        fFacetsDefined += DatatypeValidator.FACET_MINEXCLUSIVE;
  +                        fMinExclusive   = new BigDecimal(stripPlusIfPresent(value));
  +                    } else if (key.equals(SchemaSymbols.ELT_PRECISION)) {
  +                        value = ((String) facets.get(key ));
  +                        fFacetsDefined += DatatypeValidator.FACET_PRECISSION;
  +                        isPrecisionDefined = true;
  +                        fPrecision      = Integer.parseInt(value );
  +                    } else if (key.equals(SchemaSymbols.ELT_SCALE)) {
  +                        value = ((String) facets.get(key ));
  +                        fFacetsDefined += DatatypeValidator.FACET_SCALE;
  +                        isScaleDefined  = true;
  +                        fScale          = Integer.parseInt( value );
  +                    } else {
  +                        throw new InvalidDatatypeFacetException(
  +                                                                getErrorString( DatatypeMessageProvider.MSG_FORMAT_FAILURE,
  +                                                                                DatatypeMessageProvider.MSG_NONE, null));
                       }
  +                } catch ( Exception ex ){
  +                    throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                            DatatypeMessageProvider.IllegalFacetValue, 
  +                                                                            DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
                   }
  -                isMaxExclusiveDefined = ((fFacetsDefined & 
  -                                          DatatypeValidator.FACET_MAXEXCLUSIVE ) != 0 )?true:false;
  -                isMaxInclusiveDefined = ((fFacetsDefined & 
  -                                          DatatypeValidator.FACET_MAXINCLUSIVE ) != 0 )?true:false;
  -
  -                isMinExclusiveDefined = ((fFacetsDefined &
  -                                          DatatypeValidator.FACET_MINEXCLUSIVE ) != 0 )?true:false;
  -                isMinInclusiveDefined = ((fFacetsDefined &
  -                                          DatatypeValidator.FACET_MININCLUSIVE ) != 0 )?true:false;
  +            }
  +            isMaxExclusiveDefined = ((fFacetsDefined & 
  +                                        DatatypeValidator.FACET_MAXEXCLUSIVE ) != 0 )?true:false;
  +            isMaxInclusiveDefined = ((fFacetsDefined & 
  +                                        DatatypeValidator.FACET_MAXINCLUSIVE ) != 0 )?true:false;
   
  -                //checkForFacetConsistency( base );// Check the current facets against base facets
  +            isMinExclusiveDefined = ((fFacetsDefined &
  +                                        DatatypeValidator.FACET_MINEXCLUSIVE ) != 0 )?true:false;
  +            isMinInclusiveDefined = ((fFacetsDefined &
  +                                        DatatypeValidator.FACET_MININCLUSIVE ) != 0 )?true:false;
   
  -                if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
  -                    throw new InvalidDatatypeFacetException(
  -                                                           "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." ); 
  -                }
  -                if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
  -                    throw new InvalidDatatypeFacetException(
  -                                                           "It is an error for both minInclusive and minExclusive to be specified for the same datatype." ); 
  -                }
  +            //checkForFacetConsistency( base );// Check the current facets against base facets
   
  -                if ( isMaxExclusiveDefined && isMinExclusiveDefined ){
  -                    int compareTo = this.fMaxExclusive.compareTo( this.fMinExclusive );
  -                    if ( compareTo != 1)
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "maxExclusive value ='" + this.fMaxExclusive + "'must be > than minExclusive value ='" + 
  -                                                               this.fMinExclusive + "'. " );
  +            if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
  +                throw new InvalidDatatypeFacetException(
  +                                                        "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." ); 
  +            }
  +            if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
  +                throw new InvalidDatatypeFacetException(
  +                                                        "It is an error for both minInclusive and minExclusive to be specified for the same datatype." ); 
  +            }
   
  -                }
  -                if ( isMaxInclusiveDefined && isMinInclusiveDefined ){
  -                    int compareTo = this.fMaxInclusive.compareTo( this.fMinInclusive );
  +            if ( isMaxExclusiveDefined && isMinExclusiveDefined ){
  +                int compareTo = this.fMaxExclusive.compareTo( this.fMinExclusive );
  +                if ( compareTo != 1)
  +                    throw new InvalidDatatypeFacetException(
  +                                                            "maxExclusive value ='" + this.fMaxExclusive + "'must be > than minExclusive value ='" + 
  +                                                            this.fMinExclusive + "'. " );
   
  -                    if ( compareTo == -1  )
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "maxInclusive value ='" + this.fMaxInclusive + "'must be >= than minInclusive value ='" + 
  -                                                               this.fMinInclusive + "'. " );
  -                }
  +            }
  +            if ( isMaxInclusiveDefined && isMinInclusiveDefined ){
  +                int compareTo = this.fMaxInclusive.compareTo( this.fMinInclusive );
   
  +                if ( compareTo == -1  )
  +                    throw new InvalidDatatypeFacetException(
  +                                                            "maxInclusive value ='" + this.fMaxInclusive + "'must be >= than minInclusive value ='" + 
  +                                                            this.fMinInclusive + "'. " );
  +            }
   
  -                if ( isMaxExclusiveDefined && isMinInclusiveDefined ){
  -                    int compareTo = this.fMaxExclusive.compareTo( this.fMinInclusive );
  -                    if ( compareTo != 1)
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "maxExclusive value ='" + this.fMaxExclusive + "'must be > than minInclusive value ='" + 
  -                                                               this.fMinInclusive + "'. " );
   
  -                }
  -                if ( isMaxInclusiveDefined && isMinExclusiveDefined ){
  -                    int compareTo = this.fMaxInclusive.compareTo( this.fMinExclusive );
  -                    if ( compareTo != 1)
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "maxInclusive value ='" + this.fMaxInclusive + "'must be > than minExclusive value ='" + 
  -                                                               this.fMinExclusive + "'. " );
  -                }
  +            if ( isMaxExclusiveDefined && isMinInclusiveDefined ){
  +                int compareTo = this.fMaxExclusive.compareTo( this.fMinInclusive );
  +                if ( compareTo != 1)
  +                    throw new InvalidDatatypeFacetException(
  +                                                            "maxExclusive value ='" + this.fMaxExclusive + "'must be > than minInclusive value ='" + 
  +                                                            this.fMinInclusive + "'. " );
   
  +            }
  +            if ( isMaxInclusiveDefined && isMinExclusiveDefined ){
  +                int compareTo = this.fMaxInclusive.compareTo( this.fMinExclusive );
  +                if ( compareTo != 1)
  +                    throw new InvalidDatatypeFacetException(
  +                                                            "maxInclusive value ='" + this.fMaxInclusive + "'must be > than minExclusive value ='" + 
  +                                                            this.fMinExclusive + "'. " );
  +            }
   
  -                if ( (fFacetsDefined & DatatypeValidator.FACET_ENUMERATION ) != 0 ) {
  -                    if (enumeration != null) {
  -                        fEnumDecimal = new BigDecimal[enumeration.size()];
  -                        int i = 0;
  -                        try {
  -                            for ( ; i < enumeration.size(); i++) {
  -                                fEnumDecimal[i] = 
  -                                new BigDecimal( stripPlusIfPresent(((String) enumeration.elementAt(i))));
  -                                boundsCheck(fEnumDecimal[i]); // Check against max,min Inclusive, Exclusives
  -                            }
  -
  -                        } catch ( Exception idve ){
  -                            throw new InvalidDatatypeFacetException(
  -                                                                   getErrorString(DatatypeMessageProvider.InvalidEnumValue,
  -                                                                                  DatatypeMessageProvider.MSG_NONE,
  -                                                                                  new Object [] { enumeration.elementAt(i)}));
  +
  +            if ( (fFacetsDefined & DatatypeValidator.FACET_ENUMERATION ) != 0 ) {
  +                if (enumeration != null) {
  +                    fEnumDecimal = new BigDecimal[enumeration.size()];
  +                    int i = 0;
  +                    try {
  +                        for ( ; i < enumeration.size(); i++) {
  +                            fEnumDecimal[i] = 
  +                            new BigDecimal( stripPlusIfPresent(((String) enumeration.elementAt(i))));
  +                            boundsCheck(fEnumDecimal[i]); // Check against max,min Inclusive, Exclusives
                           }
   
  +                    } catch ( Exception idve ){
  +                        throw new InvalidDatatypeFacetException(
  +                                                                getErrorString(DatatypeMessageProvider.InvalidEnumValue,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                new Object [] { enumeration.elementAt(i)}));
                       }
  +
                   }
  -            } else { // Derivation by List
               }
           }//End of Facet setup
   
  @@ -268,65 +261,58 @@
        */
   
       public Object validate(String content, Object state) throws InvalidDatatypeValueException {
  +
  +        if ( this.fBaseValidator != null ) {//validate against parent type if any
  +            //System.out.println( "validator = " + this.fBaseValidator );
  +            this.fBaseValidator.validate( content, state );
  +        }
   
  -        if ( fDerivedByList == false ) { //derived by restriction
   
  -            if ( this.fBaseValidator != null ) {//validate against parent type if any
  -                //System.out.println( "validator = " + this.fBaseValidator );
  -                this.fBaseValidator.validate( content, state );
  -            }
  +        if ( (fFacetsDefined & DatatypeValidator.FACET_PATTERN ) != 0 ) {
  +            if ( fRegex == null || fRegex.matches( content) == false )
  +                throw new InvalidDatatypeValueException("Value'"+content+
  +                    "' does not match regular expression facet " + fRegex.getPattern() );
  +        }
   
  +        BigDecimal d = null; // Is content a Decimal 
  +        try {
  +            d = new BigDecimal( stripPlusIfPresent( content));
  +        } catch (Exception nfe) {
  +            throw new InvalidDatatypeValueException(
  +                                                    getErrorString(DatatypeMessageProvider.NotDecimal,
  +                                                                    DatatypeMessageProvider.MSG_NONE,
  +                                                                    new Object[] { "'" + content +"'"}));
  +        }
  +        //} 
  +        //catch (IOException ex ) {
  +        //  throw new InvalidDatatypeValueException(
  +        //  getErrorString(DatatypeMessageProvider.NotDecimal,
  +        // DatatypeMessageProvider.MSG_NONE,
  +        //                       new Object[] { "'" + content +"'"}));
  +        //}
   
  -            if ( (fFacetsDefined & DatatypeValidator.FACET_PATTERN ) != 0 ) {
  -                if ( fRegex == null || fRegex.matches( content) == false )
  -                    throw new InvalidDatatypeValueException("Value'"+content+
  -                       "' does not match regular expression facet " + fRegex.getPattern() );
  -            }
   
  -            BigDecimal d = null; // Is content a Decimal 
  -            try {
  -                d = new BigDecimal( stripPlusIfPresent( content));
  -            } catch (Exception nfe) {
  +        if ( isScaleDefined == true ) {
  +            if (d.scale() > fScale)
                   throw new InvalidDatatypeValueException(
  -                                                       getErrorString(DatatypeMessageProvider.NotDecimal,
  -                                                                      DatatypeMessageProvider.MSG_NONE,
  -                                                                      new Object[] { "'" + content +"'"}));
  -            }
  -            //} 
  -            //catch (IOException ex ) {
  -            //  throw new InvalidDatatypeValueException(
  -            //  getErrorString(DatatypeMessageProvider.NotDecimal,
  -            // DatatypeMessageProvider.MSG_NONE,
  -            //                       new Object[] { "'" + content +"'"}));
  -            //}
  -
  -
  -            if ( isScaleDefined == true ) {
  -                if (d.scale() > fScale)
  -                    throw new InvalidDatatypeValueException(
  -                                                           getErrorString(DatatypeMessageProvider.ScaleExceeded,
  -                                                                          DatatypeMessageProvider.MSG_NONE,
  -                                                                          new Object[] { content}));
  -            }
  -            if ( isPrecisionDefined == true ) {
  -                int precision = d.movePointRight(d.scale()).toString().length() - 
  -                                ((d.signum() < 0) ? 1 : 0); // account for minus sign
  -
  -                if (precision > fPrecision)
  -                    throw new InvalidDatatypeValueException(
  -                             getErrorString(DatatypeMessageProvider.PrecisionExceeded,
  +                                                        getErrorString(DatatypeMessageProvider.ScaleExceeded,
  +                                                                        DatatypeMessageProvider.MSG_NONE,
  +                                                                        new Object[] { content}));
  +        }
  +        if ( isPrecisionDefined == true ) {
  +            int precision = d.movePointRight(d.scale()).toString().length() - 
  +                            ((d.signum() < 0) ? 1 : 0); // account for minus sign
  +            if (precision > fPrecision)
  +                throw new InvalidDatatypeValueException(
  +                                getErrorString(DatatypeMessageProvider.PrecisionExceeded,
                                    DatatypeMessageProvider.MSG_NONE,
                                    new Object[] { "'" + content + "'" + "with precision = '"+ precision +"'" 
                                                 , "'" + fPrecision + "'" } ));
  -            }
  -            boundsCheck(d);
  -            if (  fEnumDecimal != null )
  -                enumCheck(d);
  -
  -
  -        } else { //derivation by list Revisit
  -
           }
  +        boundsCheck(d);
  +        if (  fEnumDecimal != null )
  +            enumCheck(d);
  +            
           return null;
       }
   
  
  
  
  1.9       +110 -121  xml-xerces/java/src/org/apache/xerces/validators/datatype/DoubleDatatypeValidator.java
  
  Index: DoubleDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/DoubleDatatypeValidator.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DoubleDatatypeValidator.java	2000/09/25 23:58:44	1.8
  +++ DoubleDatatypeValidator.java	2000/10/17 00:52:39	1.9
  @@ -68,13 +68,13 @@
    *
    * @author Ted Leung
    * @author Jeffrey Rodriguez
  - * @version $Id: DoubleDatatypeValidator.java,v 1.8 2000/09/25 23:58:44 jeffreyr Exp $
  + * @author Mark Swinkles - List Validation refactoring
  + * @version $Id: DoubleDatatypeValidator.java,v 1.9 2000/10/17 00:52:39 jeffreyr Exp $
    */
   
   public class DoubleDatatypeValidator extends AbstractDatatypeValidator {
       private Locale            fLocale           = null;
       private DatatypeValidator fBaseValidator    = null; // Null means a native datatype
  -    private boolean           fDerivedByList = false; //Derived by restriction is defaul
       private double[]          fEnumDoubles      = null;
       private String            fPattern          = null;
       private double            fMaxInclusive     = Double.POSITIVE_INFINITY;
  @@ -102,113 +102,106 @@
           if ( base != null )
               setBasetype( base ); // Set base type 
   
  -
  -        fDerivedByList = derivedByList;
  -
           if ( facets != null ) {   // Set Facet
  -            if ( fDerivedByList == false ) {
  -                for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  -                    String key = (String) e.nextElement();
  -                    if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  -                        fPattern = (String)facets.get(key);
  -                        if ( fPattern != null )
  -                            fRegex = new RegularExpression(fPattern, "X" );
  -
  -                    } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  -                        continue; //Treat the enumaration after this for loop
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value  = ((String)facets.get(key));
  -                            fMaxInclusive = Double.valueOf(value).doubleValue();
  -                        } catch (NumberFormatException ex ) {
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue, 
  -                                                                                   DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXEXCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value  = ((String)facets.get(key));
  -                            fMaxExclusive = Double.valueOf(value).doubleValue();
  -                        } catch (NumberFormatException ex ) {
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue, 
  -                                                                                   DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value  = ((String)facets.get(key));
  -                            fMinInclusive  = Double.valueOf(value).doubleValue();
  -                        } catch (NumberFormatException ex ) {
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue, 
  -                                                                                   DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value  = ((String)facets.get(key));
  -                            fMinExclusive  = Double.valueOf(value).doubleValue();
  -                        } catch (NumberFormatException ex ) {
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue, 
  -                                                                                   DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
  -                        }
  -                    } else {
  -                        throw new InvalidDatatypeFacetException( getErrorString(  DatatypeMessageProvider.MSG_FORMAT_FAILURE,
  -                                                                                  DatatypeMessageProvider.MSG_NONE,
  -                                                                                  null));
  +            for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  +                String key = (String) e.nextElement();
  +                if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  +                    fPattern = (String)facets.get(key);
  +                    if ( fPattern != null )
  +                        fRegex = new RegularExpression(fPattern, "X" );
  +
  +                } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  +                    continue; //Treat the enumaration after this for loop
  +                } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value  = ((String)facets.get(key));
  +                        fMaxInclusive = Double.valueOf(value).doubleValue();
  +                    } catch (NumberFormatException ex ) {
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue, 
  +                                                                                DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXEXCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value  = ((String)facets.get(key));
  +                        fMaxExclusive = Double.valueOf(value).doubleValue();
  +                    } catch (NumberFormatException ex ) {
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue, 
  +                                                                                DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value  = ((String)facets.get(key));
  +                        fMinInclusive  = Double.valueOf(value).doubleValue();
  +                    } catch (NumberFormatException ex ) {
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue, 
  +                                                                                DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value  = ((String)facets.get(key));
  +                        fMinExclusive  = Double.valueOf(value).doubleValue();
  +                    } catch (NumberFormatException ex ) {
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue, 
  +                                                                                DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
                       }
  +                } else {
  +                    throw new InvalidDatatypeFacetException( getErrorString(  DatatypeMessageProvider.MSG_FORMAT_FAILURE,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                null));
                   }
  -                isMaxExclusiveDefined = ((fFacetsDefined & 
  -                                          DatatypeValidator.FACET_MAXEXCLUSIVE ) != 0 )?true:false;
  -                isMaxInclusiveDefined = ((fFacetsDefined & 
  -                                          DatatypeValidator.FACET_MAXINCLUSIVE ) != 0 )?true:false;
  -                isMinExclusiveDefined = ((fFacetsDefined &
  -                                          DatatypeValidator.FACET_MINEXCLUSIVE ) != 0 )?true:false;
  -                isMinInclusiveDefined = ((fFacetsDefined &
  -                                          DatatypeValidator.FACET_MININCLUSIVE ) != 0 )?true:false;
  +            }
  +            isMaxExclusiveDefined = ((fFacetsDefined & 
  +                                        DatatypeValidator.FACET_MAXEXCLUSIVE ) != 0 )?true:false;
  +            isMaxInclusiveDefined = ((fFacetsDefined & 
  +                                        DatatypeValidator.FACET_MAXINCLUSIVE ) != 0 )?true:false;
  +            isMinExclusiveDefined = ((fFacetsDefined &
  +                                        DatatypeValidator.FACET_MINEXCLUSIVE ) != 0 )?true:false;
  +            isMinInclusiveDefined = ((fFacetsDefined &
  +                                        DatatypeValidator.FACET_MININCLUSIVE ) != 0 )?true:false;
   
   
  -                if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
  -                    throw new InvalidDatatypeFacetException(
  -                                                           "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." ); 
  -                }
  -                if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
  -                    throw new InvalidDatatypeFacetException(
  -                                                           "It is an error for both minInclusive and minExclusive to be specified for the same datatype." ); 
  -                }
  +            if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
  +                throw new InvalidDatatypeFacetException(
  +                                                        "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." ); 
  +            }
  +            if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
  +                throw new InvalidDatatypeFacetException(
  +                                                        "It is an error for both minInclusive and minExclusive to be specified for the same datatype." ); 
  +            }
   
   
   
  -                if ( (fFacetsDefined & DatatypeValidator.FACET_ENUMERATION ) != 0 ) {
  -                    Vector v = (Vector) facets.get(SchemaSymbols.ELT_ENUMERATION);    
  -                    if (v != null) {
  -                        fEnumDoubles = new double[v.size()];
  -                        for (int i = 0; i < v.size(); i++)
  -                            try {
  -                                fEnumDoubles[i] = Double.valueOf((String) v.elementAt(i)).doubleValue();
  -                                boundsCheck(fEnumDoubles[i]); // Check against max,min Inclusive, Exclusives
  -                            } catch (InvalidDatatypeValueException idve) {
  -                                throw new InvalidDatatypeFacetException(
  -                                                                       getErrorString(DatatypeMessageProvider.InvalidEnumValue,
  -                                                                                      DatatypeMessageProvider.MSG_NONE,
  -                                                                                      new Object [] { v.elementAt(i)}));
  -                            } catch (NumberFormatException nfe) {
  -                                System.out.println("Internal Error parsing enumerated values for real type");
  -                            }
  -                    }
  +            if ( (fFacetsDefined & DatatypeValidator.FACET_ENUMERATION ) != 0 ) {
  +                Vector v = (Vector) facets.get(SchemaSymbols.ELT_ENUMERATION);    
  +                if (v != null) {
  +                    fEnumDoubles = new double[v.size()];
  +                    for (int i = 0; i < v.size(); i++)
  +                        try {
  +                            fEnumDoubles[i] = Double.valueOf((String) v.elementAt(i)).doubleValue();
  +                            boundsCheck(fEnumDoubles[i]); // Check against max,min Inclusive, Exclusives
  +                        } catch (InvalidDatatypeValueException idve) {
  +                            throw new InvalidDatatypeFacetException(
  +                                                                    getErrorString(DatatypeMessageProvider.InvalidEnumValue,
  +                                                                                    DatatypeMessageProvider.MSG_NONE,
  +                                                                                    new Object [] { v.elementAt(i)}));
  +                        } catch (NumberFormatException nfe) {
  +                            System.out.println("Internal Error parsing enumerated values for real type");
  +                        }
                   }
  -            } else {
  -                //WORK TO DO -  Add derivation by list Double type
               }
           }// End of facet setting
       }
  @@ -225,31 +218,27 @@
   
       public Object validate(String content, Object state) 
       throws InvalidDatatypeValueException {
  -        if ( fDerivedByList == false ) { //derived by restriction
  -            if ( (fFacetsDefined & DatatypeValidator.FACET_PATTERN ) != 0 ) {
  -                if ( fRegex == null || fRegex.matches( content) == false )
  -                    throw new InvalidDatatypeValueException("Value'"+content+
  -                                                            "does not match regular expression facet" + fPattern );
  -            }
  +        if ( (fFacetsDefined & DatatypeValidator.FACET_PATTERN ) != 0 ) {
  +            if ( fRegex == null || fRegex.matches( content) == false )
  +                throw new InvalidDatatypeValueException("Value'"+content+
  +                                                        "does not match regular expression facet" + fPattern );
  +        }
   
   
  -            double d = 0.0;
  -            try {
  -                d = Double.valueOf(content).doubleValue();
  -            } catch (NumberFormatException nfe) {
  -                throw new InvalidDatatypeValueException(
  -                                                       getErrorString(DatatypeMessageProvider.NotReal,
  -                                                                      DatatypeMessageProvider.MSG_NONE,
  -                                                                      new Object [] { content}));
  -            }
  -            boundsCheck(d);
  +        double d = 0.0;
  +        try {
  +            d = Double.valueOf(content).doubleValue();
  +        } catch (NumberFormatException nfe) {
  +            throw new InvalidDatatypeValueException(
  +                                                    getErrorString(DatatypeMessageProvider.NotReal,
  +                                                                    DatatypeMessageProvider.MSG_NONE,
  +                                                                    new Object [] { content}));
  +        }
  +        boundsCheck(d);
   
  -            if (((fFacetsDefined & DatatypeValidator.FACET_ENUMERATION ) != 0 ) )
  -                enumCheck(d);
  +        if (((fFacetsDefined & DatatypeValidator.FACET_ENUMERATION ) != 0 ) )
  +            enumCheck(d);
   
  -        } else {
  -            ;// TODO Derived by list validation
  -        }
           return null;
       }
   
  
  
  
  1.6       +9 -42     xml-xerces/java/src/org/apache/xerces/validators/datatype/ENTITYDatatypeValidator.java
  
  Index: ENTITYDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/ENTITYDatatypeValidator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ENTITYDatatypeValidator.java	2000/08/19 00:02:31	1.5
  +++ ENTITYDatatypeValidator.java	2000/10/17 00:52:39	1.6
  @@ -105,7 +105,8 @@
    * standalone code as well as plugins to the validator architecture.
    * 
    * @author Jeffrey Rodriguez-
  - * @version $Id: ENTITYDatatypeValidator.java,v 1.5 2000/08/19 00:02:31 jeffreyr Exp $
  + * @author Mark Swinkles - List Validation refactoring
  + * @version $Id: ENTITYDatatypeValidator.java,v 1.6 2000/10/17 00:52:39 jeffreyr Exp $
    * @see org.apache.xerces.validators.datatype.DatatypeValidator
    * @see org.apache.xerces.validators.datatype.DatatypeValidatorFactoryImpl
    * @see org.apache.xerces.validators.datatype.DatatypeValidatorFactory
  @@ -113,7 +114,6 @@
    */
   public class ENTITYDatatypeValidator extends AbstractDatatypeValidator {
       private DatatypeValidator        fBaseValidator    = null;
  -    private boolean                  fDerivedByList = false;
       private DefaultEntityHandler     fEntityHandler    = null;
       private StringPool               fStringPool       = null;
   
  @@ -128,7 +128,6 @@
                                        boolean derivedByList  ) throws InvalidDatatypeFacetException {
   
           setBasetype( base ); // Set base type
  -        fDerivedByList = derivedByList;
       }
   
   
  @@ -180,45 +179,13 @@
               }
   
   
  -            if ( this.fDerivedByList == false ){
  -
  -                attValueHandle = this.fStringPool.addSymbol( content );
  -                if (!this.fEntityHandler.isUnparsedEntity( attValueHandle ) ) {
  -                    InvalidDatatypeValueException error = 
  -                    new InvalidDatatypeValueException( "ENTITY '"+ content +"' is not valid" );//Need Message
  -                    error.setMinorCode(XMLMessages.MSG_ENTITY_INVALID );
  -                    error.setMajorCode(XMLMessages.VC_ENTITY_NAME);
  -                    throw error;
  -                }
  -            } else {
  -                StringTokenizer listOfEntities = new StringTokenizer(content);
  -                StringBuffer sb = new StringBuffer(content.length());
  -                boolean ok = true;
  -                if (listOfEntities.hasMoreTokens()) {
  -                    while (true) {
  -                        String nextEntity = listOfEntities.nextToken();
  -
  -                        // ENTITIES - check that each value is an unparsed entity name (V_TAGa)
  -
  -                        if ( this.fEntityHandler.isUnparsedEntity(this.fStringPool.addSymbol(nextEntity) ) == false ) {
  -                            ok = false;
  -                        }
  -                        sb.append(nextEntity);
  -                        if (!listOfEntities.hasMoreTokens()) {
  -                            break;
  -                        }
  -                        sb.append(' ');
  -                    }
  -                }
  -                String errorContent = sb.toString();
  -                if (!ok || errorContent.length() == 0) {
  -                    InvalidDatatypeValueException error = 
  -                    new InvalidDatatypeValueException( errorContent );
  -                    error.setMinorCode(XMLMessages.MSG_ENTITIES_INVALID );
  -                    error.setMajorCode(XMLMessages.VC_ENTITY_NAME);
  -                    throw error;
  -                }
  -
  +            attValueHandle = this.fStringPool.addSymbol( content );
  +            if (!this.fEntityHandler.isUnparsedEntity( attValueHandle ) ) {
  +                InvalidDatatypeValueException error = 
  +                new InvalidDatatypeValueException( "ENTITY '"+ content +"' is not valid" );//Need Message
  +                error.setMinorCode(XMLMessages.MSG_ENTITY_INVALID );
  +                error.setMajorCode(XMLMessages.VC_ENTITY_NAME);
  +                throw error;
               }
           }
           return null;
  
  
  
  1.11      +96 -114   xml-xerces/java/src/org/apache/xerces/validators/datatype/FloatDatatypeValidator.java
  
  Index: FloatDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/FloatDatatypeValidator.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- FloatDatatypeValidator.java	2000/09/25 23:58:44	1.10
  +++ FloatDatatypeValidator.java	2000/10/17 00:52:39	1.11
  @@ -70,7 +70,8 @@
    *
    * @author Ted Leung
    * @author Jeffrey Rodriguez
  - * @version  $Id: FloatDatatypeValidator.java,v 1.10 2000/09/25 23:58:44 jeffreyr Exp $
  + * @author Mark Swinkles - List Validation refactoring
  + * @version  $Id: FloatDatatypeValidator.java,v 1.11 2000/10/17 00:52:39 jeffreyr Exp $
    */
   
   public class FloatDatatypeValidator extends AbstractDatatypeValidator {
  @@ -78,7 +79,6 @@
       private DatatypeValidator    fBaseValidator = null; // null means a native datatype
       private float[]   fEnumFloats           = null;
       private String    fPattern              = null;
  -    private boolean   fDerivedByList     = false; // Default is restriction
       private float     fMaxInclusive         = Float.POSITIVE_INFINITY ;
       private float     fMaxExclusive         = Float.POSITIVE_INFINITY;
       private float     fMinInclusive         = Float.NEGATIVE_INFINITY;
  @@ -103,116 +103,110 @@
           if ( base != null )
               setBasetype( base ); // Set base type 
   
  -        fDerivedByList = derivedByList; 
           // Set Facets if any defined
   
           if ( facets != null  )  {
  -            if ( fDerivedByList == false ) {
  -                for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  -                    String key = (String) e.nextElement();
  -
  -                    if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  -                        fPattern = (String)facets.get(key);
  -                        if ( fPattern != null )
  -                            fRegex = new RegularExpression(fPattern, "X" );
  -
  -
  -                    } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  -                        continue; //Treat the enumaration after this for loop
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value  = ((String)facets.get(key));
  -                            fMaxInclusive = Float.valueOf(value).floatValue();
  -                        } catch (NumberFormatException ex ) {
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue, 
  -                                                                                   DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXEXCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value  = ((String)facets.get(key));
  -                            fMaxExclusive = Float.valueOf(value).floatValue();
  -                        } catch (NumberFormatException ex ) {
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue, 
  -                                                                                   DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value  = ((String)facets.get(key));
  -                            fMinInclusive  = Float.valueOf(value).floatValue();
  -                        } catch (NumberFormatException ex ) {
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue, 
  -                                                                                   DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value  = ((String)facets.get(key));
  -                            fMinExclusive  = Float.valueOf(value).floatValue();
  -                        } catch (NumberFormatException ex ) {
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue, 
  -                                                                                   DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
  -                        }
  -                    } else {
  -                        throw new InvalidDatatypeFacetException( getErrorString(  DatatypeMessageProvider.MSG_FORMAT_FAILURE,
  -                                                                                  DatatypeMessageProvider.MSG_NONE,
  -                                                                                  null));
  +            for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  +                String key = (String) e.nextElement();
  +
  +                if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  +                    fPattern = (String)facets.get(key);
  +                    if ( fPattern != null )
  +                        fRegex = new RegularExpression(fPattern, "X" );
  +
  +
  +                } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  +                    continue; //Treat the enumaration after this for loop
  +                } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value  = ((String)facets.get(key));
  +                        fMaxInclusive = Float.valueOf(value).floatValue();
  +                    } catch (NumberFormatException ex ) {
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue, 
  +                                                                                DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXEXCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value  = ((String)facets.get(key));
  +                        fMaxExclusive = Float.valueOf(value).floatValue();
  +                    } catch (NumberFormatException ex ) {
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue, 
  +                                                                                DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value  = ((String)facets.get(key));
  +                        fMinInclusive  = Float.valueOf(value).floatValue();
  +                    } catch (NumberFormatException ex ) {
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue, 
  +                                                                                DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
                       }
  +                } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value  = ((String)facets.get(key));
  +                        fMinExclusive  = Float.valueOf(value).floatValue();
  +                    } catch (NumberFormatException ex ) {
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue, 
  +                                                                                DatatypeMessageProvider.MSG_NONE, new Object [] { value, key}));
  +                    }
  +                } else {
  +                    throw new InvalidDatatypeFacetException( getErrorString(  DatatypeMessageProvider.MSG_FORMAT_FAILURE,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                null));
                   }
  -                isMaxExclusiveDefined = ((fFacetsDefined & 
  -                                          DatatypeValidator.FACET_MAXEXCLUSIVE ) != 0 )?true:false;
  -                isMaxInclusiveDefined = ((fFacetsDefined & 
  -                                          DatatypeValidator.FACET_MAXINCLUSIVE ) != 0 )?true:false;
  -                isMinExclusiveDefined = ((fFacetsDefined &
  -                                          DatatypeValidator.FACET_MINEXCLUSIVE ) != 0 )?true:false;
  -                isMinInclusiveDefined = ((fFacetsDefined &
  -                                          DatatypeValidator.FACET_MININCLUSIVE ) != 0 )?true:false;
  +            }
  +            isMaxExclusiveDefined = ((fFacetsDefined & 
  +                                        DatatypeValidator.FACET_MAXEXCLUSIVE ) != 0 )?true:false;
  +            isMaxInclusiveDefined = ((fFacetsDefined & 
  +                                        DatatypeValidator.FACET_MAXINCLUSIVE ) != 0 )?true:false;
  +            isMinExclusiveDefined = ((fFacetsDefined &
  +                                        DatatypeValidator.FACET_MINEXCLUSIVE ) != 0 )?true:false;
  +            isMinInclusiveDefined = ((fFacetsDefined &
  +                                        DatatypeValidator.FACET_MININCLUSIVE ) != 0 )?true:false;
   
   
  -                if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
  -                    throw new InvalidDatatypeFacetException(
  -                                                           "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." ); 
  -                }
  -                if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
  -                    throw new InvalidDatatypeFacetException(
  -                                                           "It is an error for both minInclusive and minExclusive to be specified for the same datatype." ); 
  -                }
  +            if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
  +                throw new InvalidDatatypeFacetException(
  +                                                        "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." ); 
  +            }
  +            if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
  +                throw new InvalidDatatypeFacetException(
  +                                                        "It is an error for both minInclusive and minExclusive to be specified for the same datatype." ); 
  +            }
   
   
   
  -                if ( (fFacetsDefined & DatatypeValidator.FACET_ENUMERATION ) != 0 ) {
  -                    Vector v = (Vector) facets.get(SchemaSymbols.ELT_ENUMERATION);    
  -                    if (v != null) {
  -                        fEnumFloats = new float[v.size()];
  -                        for (int i = 0; i < v.size(); i++)
  -                            try {
  -                                fEnumFloats[i] = Float.valueOf((String) v.elementAt(i)).floatValue();
  -                                boundsCheck(fEnumFloats[i]); // Check against max,min Inclusive, Exclusives
  -                            } catch (InvalidDatatypeValueException idve) {
  -                                throw new InvalidDatatypeFacetException(
  -                                                                       getErrorString(DatatypeMessageProvider.InvalidEnumValue,
  -                                                                                      DatatypeMessageProvider.MSG_NONE,
  -                                                                                      new Object [] { v.elementAt(i)}));
  -                            } catch (NumberFormatException nfe) {
  -                                System.out.println("Internal Error parsing enumerated values for real type");
  -                            }
  -                    }
  +            if ( (fFacetsDefined & DatatypeValidator.FACET_ENUMERATION ) != 0 ) {
  +                Vector v = (Vector) facets.get(SchemaSymbols.ELT_ENUMERATION);    
  +                if (v != null) {
  +                    fEnumFloats = new float[v.size()];
  +                    for (int i = 0; i < v.size(); i++)
  +                        try {
  +                            fEnumFloats[i] = Float.valueOf((String) v.elementAt(i)).floatValue();
  +                            boundsCheck(fEnumFloats[i]); // Check against max,min Inclusive, Exclusives
  +                        } catch (InvalidDatatypeValueException idve) {
  +                            throw new InvalidDatatypeFacetException(
  +                                                                    getErrorString(DatatypeMessageProvider.InvalidEnumValue,
  +                                                                                    DatatypeMessageProvider.MSG_NONE,
  +                                                                                    new Object [] { v.elementAt(i)}));
  +                        } catch (NumberFormatException nfe) {
  +                            System.out.println("Internal Error parsing enumerated values for real type");
  +                        }
                   }
  -            } else { //derivation by list  - WORK TO DO
  -                //System.out.println( "inside derive by list" );
  -
               }
           }// End facet setup
       }
  @@ -236,19 +230,7 @@
        */
       public Object validate(String content, Object state) 
       throws InvalidDatatypeValueException {
  -
  -        if ( fDerivedByList == false  ) {
  -            checkContent(  content );
  -        } else {
  -           StringTokenizer parsedList = new StringTokenizer( content );
  -           try {
  -               while ( parsedList.hasMoreTokens() ) {
  -                   checkContent( parsedList.nextToken() );
  -               }
  -           } catch ( NoSuchElementException e ) {
  -               e.printStackTrace();
  -           }
  -        }
  +        checkContent(  content );
           return null;
       }
   
  
  
  
  1.14      +26 -35    xml-xerces/java/src/org/apache/xerces/validators/datatype/IDDatatypeValidator.java
  
  Index: IDDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/IDDatatypeValidator.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- IDDatatypeValidator.java	2000/09/12 03:44:01	1.13
  +++ IDDatatypeValidator.java	2000/10/17 00:52:39	1.14
  @@ -67,11 +67,11 @@
    * These validators can be supplied by the application writer and may be useful as
    * standalone code as well as plugins to the validator architecture.
    * @author Jeffrey Rodriguez
  - * @version $Id: IDDatatypeValidator.java,v 1.13 2000/09/12 03:44:01 jeffreyr Exp $
  + * @author Mark Swinkles - List Validation refactoring
  + * @version $Id: IDDatatypeValidator.java,v 1.14 2000/10/17 00:52:39 jeffreyr Exp $
    */
   public class IDDatatypeValidator extends AbstractDatatypeValidator {
       private DatatypeValidator         fBaseValidator = null;
  -    private boolean                   fDerivedByList = false;
       private Object                        fNullValue = null;
       private DatatypeMessageProvider fMessageProvider = new DatatypeMessageProvider();
       private Hashtable                     fTableOfId;
  @@ -87,7 +87,6 @@
   
       public IDDatatypeValidator ( DatatypeValidator base, Hashtable facets, 
                                    boolean derivedByList ) throws InvalidDatatypeFacetException  {
  -        fDerivedByList = derivedByList;
       }
   
   
  @@ -109,35 +108,33 @@
       public Object validate(String content, Object IDStorage ) throws InvalidDatatypeValueException{
   
           StateMessageDatatype message;
  -        if ( this.fDerivedByList == false ){
  -            if (IDStorage != null ){
  -                //System.out.println("We received reset" );
  -                message = (StateMessageDatatype) IDStorage;    
  -                if (message.getDatatypeState() == IDDatatypeValidator.ID_CLEAR ){
  -                    if ( this.fTableOfId  != null ){
  -                        this.fTableOfId.clear(); //Clean the ID Hash Table see the XMLValidator pool reset method
  -                        this.fTableOfId = null;
  -                    }
  -                    return null;
  -                }
  -            }
  -            if (!XMLCharacterProperties.validName(content)) {//Check if is valid key-[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
  -                InvalidDatatypeValueException error =  new
  -                                                       InvalidDatatypeValueException( "ID is not valid: " + content );
  -                error.setMinorCode(XMLMessages.MSG_ID_INVALID);
  -                error.setMajorCode(XMLMessages.VC_ID);
  -                throw error;
  -            }
   
  -            if (!addId( content, IDStorage) ){ //It is OK to pass a null here
  -                InvalidDatatypeValueException error = 
  -                new InvalidDatatypeValueException( "ID '" + content +"'  has to be unique" );
  -                error.setMinorCode(XMLMessages.MSG_ID_NOT_UNIQUE);
  -                error.setMajorCode(XMLMessages.VC_ID);
  -                throw error;
  +        if (IDStorage != null ){
  +            //System.out.println("We received reset" );
  +            message = (StateMessageDatatype) IDStorage;    
  +            if (message.getDatatypeState() == IDDatatypeValidator.ID_CLEAR ){
  +                if ( this.fTableOfId  != null ){
  +                    this.fTableOfId.clear(); //Clean the ID Hash Table see the XMLValidator pool reset method
  +                    this.fTableOfId = null;
  +                }
  +                return null;
               }
  -        } else{ //Need to revisit case when derived by list
  +        }
  +        
  +        if (!XMLCharacterProperties.validName(content)) {//Check if is valid key-[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
  +            InvalidDatatypeValueException error =  new
  +                                                    InvalidDatatypeValueException( "ID is not valid: " + content );
  +            error.setMinorCode(XMLMessages.MSG_ID_INVALID);
  +            error.setMajorCode(XMLMessages.VC_ID);
  +            throw error;
  +        }
   
  +        if (!addId( content, IDStorage) ){ //It is OK to pass a null here
  +            InvalidDatatypeValueException error = 
  +            new InvalidDatatypeValueException( "ID '" + content +"'  has to be unique" );
  +            error.setMinorCode(XMLMessages.MSG_ID_NOT_UNIQUE);
  +            error.setMajorCode(XMLMessages.VC_ID);
  +            throw error;
           }
           //System.out.println("IDStorage = " + IDStorage );
           //System.out.println("Bef return = " + fTableOfId );
  @@ -169,10 +166,6 @@
   
   
       /**
  -     * Name of base type as a string.
  -     * A Native datatype has the string "native"  as its
  -     * base type.
  -     * 
        * @param base   the validator for this type's base type
        */
       private void setBasetype(DatatypeValidator base){
  @@ -218,6 +211,4 @@
               return "Illegal Errorcode "+minor;
           }
       }
  -
  -
   }
  
  
  
  1.13      +25 -60    xml-xerces/java/src/org/apache/xerces/validators/datatype/IDREFDatatypeValidator.java
  
  Index: IDREFDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/IDREFDatatypeValidator.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- IDREFDatatypeValidator.java	2000/09/12 03:44:21	1.12
  +++ IDREFDatatypeValidator.java	2000/10/17 00:52:39	1.13
  @@ -74,11 +74,11 @@
    * standalone code as well as plugins to the validator architecture.
    * 
    * @author Jeffrey Rodriguez-
  - * @version $Id: IDREFDatatypeValidator.java,v 1.12 2000/09/12 03:44:21 jeffreyr Exp $
  + * @author Mark Swinkles - List Validation refactoring
  + * @version $Id: IDREFDatatypeValidator.java,v 1.13 2000/10/17 00:52:39 jeffreyr Exp $
    */
   public class IDREFDatatypeValidator extends AbstractDatatypeValidator {
       private DatatypeValidator fBaseValidator    = null;
  -    private boolean           fDerivedByList    = false;
       private Hashtable              fTableOfId   = null; //This is pass to us through the state object
       private Hashtable              fTableIDRefs = null;
       private Object                   fNullValue = null;
  @@ -98,7 +98,6 @@
       public IDREFDatatypeValidator ( DatatypeValidator base, Hashtable facets, 
                                       boolean derivedByList ) throws InvalidDatatypeFacetException { 
   
  -        fDerivedByList = derivedByList;
           setBasetype( base ); // Set base type 
   
       }
  @@ -128,66 +127,32 @@
             //  this.fBaseValidator.validate( content, state );
           //}
           StateMessageDatatype message;
  -        if ( this.fDerivedByList == false ){
  -            //System.out.println("conten = " + content );
  -            if (state!= null){
  -                message = (StateMessageDatatype) state;    
  -                if (message.getDatatypeState() == IDREFDatatypeValidator.IDREF_CLEAR ){
  -                    if ( this.fTableOfId != null ){
  -                        fTableOfId.clear(); //This is pass to us through the state object
  -                    }
  -                    if ( this.fTableIDRefs != null ){
  -                        fTableIDRefs.clear(); 
  -                    }
  -                    return null;
  -                } else if ( message.getDatatypeState() == IDREFDatatypeValidator.IDREF_VALIDATE ){
  -                    this.checkIdRefs();//Validate that all keyRef is a keyIds
  -                } else if ( message.getDatatypeState() == IDREFDatatypeValidator.IDREF_STORE ) {
  -                    this.fTableOfId = (Hashtable) message.getDatatypeObject();
  -                    if (!XMLCharacterProperties.validName(content)) {//Check if is valid key
  -
  -                        InvalidDatatypeValueException error = new InvalidDatatypeValueException( "IDREF is not valid" );//Need Message
  -
  -                        error.setMinorCode(XMLMessages.MSG_IDREF_INVALID );
  -                        error.setMajorCode(XMLMessages.VC_IDREF);
  -                        throw error;//Need Message
  -                    }
  -                    //System.out.println("Content REF = " + content );
  -                    addIdRef( content, state);// We are storing IDs 
  +        //System.out.println("conten = " + content );
  +        if (state!= null){
  +            message = (StateMessageDatatype) state;    
  +            if (message.getDatatypeState() == IDREFDatatypeValidator.IDREF_CLEAR ){
  +                if ( this.fTableOfId != null ){
  +                    fTableOfId.clear(); //This is pass to us through the state object
                   }
  -            }
  -         } else {
  -            //System.out.println("list = " + content );
  -            if (state!= null){
  -                message = (StateMessageDatatype) state;    
  -                if (message.getDatatypeState() == IDREFDatatypeValidator.IDREF_CLEAR ){
  -                    if ( this.fTableOfId != null ){
  -                        fTableOfId.clear(); //This is pass to us through the state object
  -                    }
  -                    if ( this.fTableIDRefs != null ){
  -                        fTableIDRefs.clear(); 
  -                    }
  -                    return null;
  -
  -                } else if ( message.getDatatypeState() == IDREFDatatypeValidator.IDREF_VALIDATE ){
  -                    //System.out.println("Call to Validate IDREFS" );
  -                    this.checkIdRefs();//Validate that all keyRef is a keyIds
  -                } else if ( message.getDatatypeState() == IDREFDatatypeValidator.IDREF_STORE ) {
  -                    //System.out.println("IDREFS = " + content );
  -                    StringTokenizer   tokenizer = new StringTokenizer( content );
  -                    this.fTableOfId = (Hashtable) message.getDatatypeObject();
  -                    while ( tokenizer.hasMoreTokens() ) {
  -                        String idName = tokenizer.nextToken(); 
  -                        //System.out.println("idName here = " + idName );
  -                        if( this.fBaseValidator != null ){
  -                               this.fBaseValidator.validate( idName, state );
  -                        }
  -                        addIdRef( idName, state);// We are storing IDs 
  -                    }
  +                if ( this.fTableIDRefs != null ){
  +                    fTableIDRefs.clear(); 
                   }
  -
  +                return null;
  +            } else if ( message.getDatatypeState() == IDREFDatatypeValidator.IDREF_VALIDATE ){
  +                this.checkIdRefs();//Validate that all keyRef is a keyIds
  +            } else if ( message.getDatatypeState() == IDREFDatatypeValidator.IDREF_STORE ) {
  +                this.fTableOfId = (Hashtable) message.getDatatypeObject();
  +                if (!XMLCharacterProperties.validName(content)) {//Check if is valid key
  +
  +                    InvalidDatatypeValueException error = new InvalidDatatypeValueException( "IDREF is not valid" );//Need Message
  +
  +                    error.setMinorCode(XMLMessages.MSG_IDREF_INVALID );
  +                    error.setMajorCode(XMLMessages.VC_IDREF);
  +                    throw error;//Need Message
  +                }
  +                //System.out.println("Content REF = " + content );
  +                addIdRef( content, state);// We are storing IDs 
               }
  -
           }
           return null;
       }
  
  
  
  1.8       +1 -0      xml-xerces/java/src/org/apache/xerces/validators/datatype/Makefile
  
  Index: Makefile
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/Makefile,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Makefile	2000/08/11 02:12:02	1.7
  +++ Makefile	2000/10/17 00:52:39	1.8
  @@ -15,6 +15,7 @@
   	IDREFDatatypeValidator.class \
   	InvalidDatatypeFacetException.class\
   	InvalidDatatypeValueException.class\
  +	ListDatatypeValidator.class \
   	NOTATIONDatatypeValidator.class \
   	QNameDatatypeValidator.class\
   	StringDatatypeValidator.class\
  
  
  
  1.4       +2 -3      xml-xerces/java/src/org/apache/xerces/validators/datatype/NOTATIONDatatypeValidator.java
  
  Index: NOTATIONDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/NOTATIONDatatypeValidator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NOTATIONDatatypeValidator.java	2000/06/23 01:26:29	1.3
  +++ NOTATIONDatatypeValidator.java	2000/10/17 00:52:39	1.4
  @@ -66,11 +66,11 @@
    * standalone code as well as plugins to the validator architecture.
    * 
    * @author Jeffrey Rodriguez-
  - * @version $Id: NOTATIONDatatypeValidator.java,v 1.3 2000/06/23 01:26:29 jeffreyr Exp $
  + * @author Mark Swinkles - List Validation refactoring
  + * @version $Id: NOTATIONDatatypeValidator.java,v 1.4 2000/10/17 00:52:39 jeffreyr Exp $
    */
   public class NOTATIONDatatypeValidator extends AbstractDatatypeValidator {
       private DatatypeValidator fBaseValidator = null;
  -    private boolean   fDerivedByList     = false; // Default is
   
       public NOTATIONDatatypeValidator () throws InvalidDatatypeFacetException {
           this( null, null, false ); // Native, No Facets defined, Restriction
  @@ -78,7 +78,6 @@
   
       public NOTATIONDatatypeValidator ( DatatypeValidator base, Hashtable facets, 
            boolean derivedByList ) throws InvalidDatatypeFacetException {
  -         fDerivedByList = derivedByList;
            setBasetype( base ); // Set base type 
       }
   
  
  
  
  1.7       +83 -166   xml-xerces/java/src/org/apache/xerces/validators/datatype/QNameDatatypeValidator.java
  
  Index: QNameDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/QNameDatatypeValidator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- QNameDatatypeValidator.java	2000/06/23 01:26:30	1.6
  +++ QNameDatatypeValidator.java	2000/10/17 00:52:40	1.7
  @@ -78,12 +78,12 @@
    * XML]. 
    * 
    * @author Jeffrey Rodriguez
  - * @version $Id: QNameDatatypeValidator.java,v 1.6 2000/06/23 01:26:30 jeffreyr Exp $
  + * @author Mark Swinkles - List Validation refactoring
  + * @version $Id: QNameDatatypeValidator.java,v 1.7 2000/10/17 00:52:40 jeffreyr Exp $
    */
   public class QNameDatatypeValidator extends  AbstractDatatypeValidator {
       private Locale    fLocale          = null;
       private DatatypeValidator    fBaseValidator   = null;
  -    private boolean fDerivedByList             = false;
   
       private int       fLength          = 0;
       private int       fMaxLength       = Integer.MAX_VALUE;
  @@ -112,157 +112,98 @@
   
           setBasetype( base ); // Set base type 
   
  -        fDerivedByList = derivedByList;
  -
           // Set Facets if any defined
           if ( facets != null  ){
  -            if ( fDerivedByList == false) {
  -                for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  -                    String key = (String) e.nextElement();
  -
  -                    if ( key.equals(SchemaSymbols.ELT_LENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_LENGTH;
  -                        String lengthValue = (String)facets.get(key);
  -                        try {
  -                            fLength     = Integer.parseInt( lengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"' is invalid.");
  -                        }
  -                        if ( fLength < 0 )
  -                            throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"'  must be a nonNegativeInteger.");
  -
  -                    } else if (key.equals(SchemaSymbols.ELT_MINLENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MINLENGTH;
  -                        String minLengthValue = (String)facets.get(key);
  -                        try {
  -                            fMinLength     = Integer.parseInt( minLengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("maxLength value '"+minLengthValue+"' is invalid.");
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXLENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXLENGTH;
  -                        String maxLengthValue = (String)facets.get(key);
  -                        try {
  -                            fMaxLength     = Integer.parseInt( maxLengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("maxLength value '"+maxLengthValue+"' is invalid.");
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  -                        fPattern = (String)facets.get(key);
  -                        fRegex   = new RegularExpression(fPattern, "X");
  -                    } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  -                        fEnumeration = (Vector)facets.get(key);
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  -                        fMaxInclusive = (String)facets.get(key);
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXEXCLUSIVE;
  -                        fMaxExclusive = (String)facets.get(key);
  -                    } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  -                        fMinInclusive = (String)facets.get(key);
  -                    } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MINEXCLUSIVE;
  -                        fMinExclusive = (String)facets.get(key);
  -                    } else {
  -                        throw new InvalidDatatypeFacetException();
  -                    }
  -                }
  +            for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  +                String key = (String) e.nextElement();
   
  -                if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
  -                    if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "It is an error for both length and maxLength to be members of facets." );  
  -                    } else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "It is an error for both length and minLength to be members of facets." );
  -                    }
  +                if ( key.equals(SchemaSymbols.ELT_LENGTH) ) {
  +                    fFacetsDefined += DatatypeValidator.FACET_LENGTH;
  +                    String lengthValue = (String)facets.get(key);
  +                    try {
  +                        fLength     = Integer.parseInt( lengthValue );
  +                    } catch (NumberFormatException nfe) {
  +                        throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"' is invalid.");
  +                    }
  +                    if ( fLength < 0 )
  +                        throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"'  must be a nonNegativeInteger.");
  +
  +                } else if (key.equals(SchemaSymbols.ELT_MINLENGTH) ) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MINLENGTH;
  +                    String minLengthValue = (String)facets.get(key);
  +                    try {
  +                        fMinLength     = Integer.parseInt( minLengthValue );
  +                    } catch (NumberFormatException nfe) {
  +                        throw new InvalidDatatypeFacetException("maxLength value '"+minLengthValue+"' is invalid.");
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_MAXLENGTH) ) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXLENGTH;
  +                    String maxLengthValue = (String)facets.get(key);
  +                    try {
  +                        fMaxLength     = Integer.parseInt( maxLengthValue );
  +                    } catch (NumberFormatException nfe) {
  +                        throw new InvalidDatatypeFacetException("maxLength value '"+maxLengthValue+"' is invalid.");
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  +                    fPattern = (String)facets.get(key);
  +                    fRegex   = new RegularExpression(fPattern, "X");
  +                } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  +                    fEnumeration = (Vector)facets.get(key);
  +                } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  +                    fMaxInclusive = (String)facets.get(key);
  +                } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXEXCLUSIVE;
  +                    fMaxExclusive = (String)facets.get(key);
  +                } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  +                    fMinInclusive = (String)facets.get(key);
  +                } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MINEXCLUSIVE;
  +                    fMinExclusive = (String)facets.get(key);
  +                } else {
  +                    throw new InvalidDatatypeFacetException();
                   }
  -
  -                if ( ( (fFacetsDefined & ( DatatypeValidator.FACET_MINLENGTH |
  -                                           DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
  -                    if ( fMinLength > fMaxLength ) {
  -                        throw new InvalidDatatypeFacetException( "Value of maxLength = " + fMaxLength +
  -                                                                 "must be greater that the value of minLength" + fMinLength );
  -                    }
  -                }
  -
  -                isMaxExclusiveDefined = ((fFacetsDefined & 
  -                                          DatatypeValidator.FACET_MAXEXCLUSIVE ) != 0 )?true:false;
  -                isMaxInclusiveDefined = ((fFacetsDefined & 
  -                                          DatatypeValidator.FACET_MAXINCLUSIVE ) != 0 )?true:false;
  -                isMinExclusiveDefined = ((fFacetsDefined &
  -                                          DatatypeValidator.FACET_MINEXCLUSIVE ) != 0 )?true:false;
  -                isMinInclusiveDefined = ((fFacetsDefined &
  -                                          DatatypeValidator.FACET_MININCLUSIVE ) != 0 )?true:false;
  +            }
   
  -                if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
  +            if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
  +                if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
                       throw new InvalidDatatypeFacetException(
  -                                                           "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." ); 
  -                }
  -                if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
  +                                                            "It is an error for both length and maxLength to be members of facets." );  
  +                } else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
                       throw new InvalidDatatypeFacetException(
  -                                                           "It is an error for both minInclusive and minExclusive to be specified for the same datatype." ); 
  -                }
  -            } else { //derived by list
  -                for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  -                    String key = (String) e.nextElement();
  -                    if ( key.equals(SchemaSymbols.ELT_LENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_LENGTH;
  -                        String lengthValue = (String)facets.get(key);
  -                        try {
  -                            fLength     = Integer.parseInt( lengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"' is invalid.");
  -                        }
  -                        if ( fLength < 0 )
  -                            throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"'  must be a nonNegativeInteger.");
  -
  -                    } else if (key.equals(SchemaSymbols.ELT_MINLENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MINLENGTH;
  -                        String minLengthValue = (String)facets.get(key);
  -                        try {
  -                            fMinLength     = Integer.parseInt( minLengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("maxLength value '"+minLengthValue+"' is invalid.");
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXLENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXLENGTH;
  -                        String maxLengthValue = (String)facets.get(key);
  -                        try {
  -                            fMaxLength     = Integer.parseInt( maxLengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("maxLength value '"+maxLengthValue+"' is invalid.");
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  -                        fEnumeration    = (Vector)facets.get(key);
  -                    } else {
  -                        throw new InvalidDatatypeFacetException();
  -                    }
  -                }
  -                if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
  -                    if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "It is an error for both length and maxLength to be members of facets." );  
  -                    } else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "It is an error for both length and minLength to be members of facets." );
  -                    }
  +                                                            "It is an error for both length and minLength to be members of facets." );
                   }
  +            }
   
  -                if ( ( (fFacetsDefined & ( DatatypeValidator.FACET_MINLENGTH |
  -                                           DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
  -                    if ( fMinLength < fMaxLength ) {
  -                        throw new InvalidDatatypeFacetException( "Value of minLength = " + fMinLength +
  -                                                                 "must be greater that the value of maxLength" + fMaxLength );
  -                    }
  +            if ( ( (fFacetsDefined & ( DatatypeValidator.FACET_MINLENGTH |
  +                                        DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
  +                if ( fMinLength > fMaxLength ) {
  +                    throw new InvalidDatatypeFacetException( "Value of maxLength = " + fMaxLength +
  +                                                                "must be greater that the value of minLength" + fMinLength );
                   }
               }
  -        }// End of Facets Setting
   
  +            isMaxExclusiveDefined = ((fFacetsDefined & 
  +                                        DatatypeValidator.FACET_MAXEXCLUSIVE ) != 0 )?true:false;
  +            isMaxInclusiveDefined = ((fFacetsDefined & 
  +                                        DatatypeValidator.FACET_MAXINCLUSIVE ) != 0 )?true:false;
  +            isMinExclusiveDefined = ((fFacetsDefined &
  +                                        DatatypeValidator.FACET_MINEXCLUSIVE ) != 0 )?true:false;
  +            isMinInclusiveDefined = ((fFacetsDefined &
  +                                        DatatypeValidator.FACET_MININCLUSIVE ) != 0 )?true:false;
  +
  +            if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
  +                throw new InvalidDatatypeFacetException(
  +                                                        "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." ); 
  +            }
  +            if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
  +                throw new InvalidDatatypeFacetException(
  +                                                        "It is an error for both minInclusive and minExclusive to be specified for the same datatype." ); 
  +            }
  +        }// End of Facets Setting
   
       }
   
  @@ -279,20 +220,7 @@
   */
       public Object validate(String content, Object state)  throws InvalidDatatypeValueException
       {
  -        StringTokenizer parsedList = null;
  -
  -        if ( fDerivedByList == true  ) { //derived by list
  -            parsedList = new StringTokenizer( content );
  -            try {
  -                while ( parsedList.hasMoreTokens() ) {
  -                    checkContentList( parsedList.nextToken() );
  -                }
  -            } catch ( NoSuchElementException e ) {
  -                e.printStackTrace();
  -            }
  -        } else { //derived by list
  -            checkContent( content );
  -        }
  +        checkContent( content );
           return null;
       }
   
  @@ -388,19 +316,8 @@
           throw new CloneNotSupportedException("clone() is not supported in "+this.getClass().getName());
       }
   
  -
  -
  -    private void checkContentList( String content )throws InvalidDatatypeValueException
  -    {
  -//Revisit
  -    }
  -
  -
       private void setBasetype( DatatypeValidator base) {
           fBaseValidator = base;
       }
  -
  -
  -
   }
   
  
  
  
  1.8       +185 -202  xml-xerces/java/src/org/apache/xerces/validators/datatype/RecurringDurationDatatypeValidator.java
  
  Index: RecurringDurationDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/RecurringDurationDatatypeValidator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RecurringDurationDatatypeValidator.java	2000/08/01 06:06:24	1.7
  +++ RecurringDurationDatatypeValidator.java	2000/10/17 00:52:40	1.8
  @@ -72,7 +72,8 @@
    *
    *
    * @author Ted Leung, George Joseph, Jeffrey Rodriguez,  
  - * @version $Id: RecurringDurationDatatypeValidator.java,v 1.7 2000/08/01 06:06:24 jeffreyr Exp $
  + * @author Mark Swinkles - List Validation refactoring
  + * @version $Id: RecurringDurationDatatypeValidator.java,v 1.8 2000/10/17 00:52:40 jeffreyr Exp $
    */
   
   public class RecurringDurationDatatypeValidator extends AbstractDatatypeValidator {
  @@ -94,7 +95,6 @@
       boolean           isMinInclusiveDefined = false;
       boolean           isBaseTypeTimePeriod  = false;
       int               fFacetsDefined        = 0;
  -    boolean           fDerivedByList        = false;
       Hashtable         fFacets        = null;
   
   
  @@ -110,8 +110,6 @@
       public  RecurringDurationDatatypeValidator ( DatatypeValidator base, Hashtable facets, 
                                                    boolean derivedByList ) throws InvalidDatatypeFacetException {
   
  -        fDerivedByList = derivedByList;
  -
           if ( base != null )
           {
               setBasetype( base ); // Set base type 
  @@ -121,186 +119,178 @@
           // Set Facets if any defined
   
           if ( facets != null  )  {
  -            if ( fDerivedByList == false ) { // Restriction
  -
  -                for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  +            for (Enumeration e = facets.keys(); e.hasMoreElements();) {
   
  -                    String key = (String) e.nextElement();
  +                String key = (String) e.nextElement();
   
  -                    if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  -                        fPattern = (String)facets.get(key);
  -                    } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  -                        continue; //Treat the enumeration after this for loop
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value         = ((String)facets.get(key));
  -
  -
  -                            fMaxInclusive = normalizeRecurringDuration( value.toCharArray(), 0) ;
  -                        } catch ( InvalidDatatypeValueException nfe ){
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue,
  -                                                                                   DatatypeMessageProvider.MSG_NONE,
  -                                                                                   new Object [] { value, key}));
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXEXCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value         = ((String)facets.get(key));
  -                            fMaxExclusive = normalizeRecurringDuration( value.toCharArray(), 0 );
  -                        } catch ( InvalidDatatypeValueException nfe ){
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue,
  -                                                                                   DatatypeMessageProvider.MSG_NONE,
  -                                                                                   new Object [] { value, key}));
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value         = ((String)facets.get(key));
  -                            fMinInclusive = normalizeRecurringDuration( value.toCharArray(), 0 );
  -                        } catch ( InvalidDatatypeValueException nfe ){
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue,
  -                                                                                   DatatypeMessageProvider.MSG_NONE,
  -                                                                                   new Object [] { value, key}));
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value         = ((String)facets.get(key));
  -                            fMinExclusive = normalizeRecurringDuration( value.toCharArray(), 0 ); 
  -                        } catch ( InvalidDatatypeValueException nfe ) {
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue,
  -                                                                                   DatatypeMessageProvider.MSG_NONE,
  -                                                                                   new Object [] { value, key}));
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_PERIOD  )) {
  -                        fFacetsDefined += DatatypeValidator.FACET_PERIOD;
  -                        String value = null;
  -                        try {
  -                            value         = ((String)facets.get(key));
  -                            fPeriod   = normalizeRecurringDuration( value.toCharArray(), 0 ); 
  -                            if ( fDbug == true ){
  -                                System.out.println( "value = " + value );
  -                                System.out.println("fPeriod = " + fPeriod );
  -                            }
  -                        } catch ( InvalidDatatypeValueException nfe ) {
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue,
  -                                                                                   DatatypeMessageProvider.MSG_NONE,
  -                                                                                   new Object [] { value, key}));
  +                if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  +                    fPattern = (String)facets.get(key);
  +                } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  +                    continue; //Treat the enumeration after this for loop
  +                } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value         = ((String)facets.get(key));
  +
  +
  +                        fMaxInclusive = normalizeRecurringDuration( value.toCharArray(), 0) ;
  +                    } catch ( InvalidDatatypeValueException nfe ){
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                new Object [] { value, key}));
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXEXCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value         = ((String)facets.get(key));
  +                        fMaxExclusive = normalizeRecurringDuration( value.toCharArray(), 0 );
  +                    } catch ( InvalidDatatypeValueException nfe ){
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                new Object [] { value, key}));
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value         = ((String)facets.get(key));
  +                        fMinInclusive = normalizeRecurringDuration( value.toCharArray(), 0 );
  +                    } catch ( InvalidDatatypeValueException nfe ){
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                new Object [] { value, key}));
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value         = ((String)facets.get(key));
  +                        fMinExclusive = normalizeRecurringDuration( value.toCharArray(), 0 ); 
  +                    } catch ( InvalidDatatypeValueException nfe ) {
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                new Object [] { value, key}));
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_PERIOD  )) {
  +                    fFacetsDefined += DatatypeValidator.FACET_PERIOD;
  +                    String value = null;
  +                    try {
  +                        value         = ((String)facets.get(key));
  +                        fPeriod   = normalizeRecurringDuration( value.toCharArray(), 0 ); 
  +                        if ( fDbug == true ){
  +                            System.out.println( "value = " + value );
  +                            System.out.println("fPeriod = " + fPeriod );
                           }
  -                    } else if (key.equals(SchemaSymbols.ELT_DURATION )) {
  -                        fFacetsDefined += DatatypeValidator.FACET_DURATION;
  -                        String value = null;
  -                        try {
  -                            value         = ((String)facets.get(key));
  -                            fDuration     = normalizeRecurringDuration( value.toCharArray(), 0 ); 
  -                            if ( fDbug == true ){
  -                                System.out.println("fDuration = " + fDuration );
  -                            }
  -                        } catch ( InvalidDatatypeValueException nfe ) {
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue,
  -                                                                                   DatatypeMessageProvider.MSG_NONE,
  -                                                                                   new Object [] { value, key}));
  +                    } catch ( InvalidDatatypeValueException nfe ) {
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                new Object [] { value, key}));
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_DURATION )) {
  +                    fFacetsDefined += DatatypeValidator.FACET_DURATION;
  +                    String value = null;
  +                    try {
  +                        value         = ((String)facets.get(key));
  +                        fDuration     = normalizeRecurringDuration( value.toCharArray(), 0 ); 
  +                        if ( fDbug == true ){
  +                            System.out.println("fDuration = " + fDuration );
                           }
  +                    } catch ( InvalidDatatypeValueException nfe ) {
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                new Object [] { value, key}));
  +                    }
   
   
  -                    } else {
  -                        throw new InvalidDatatypeFacetException( getErrorString(  DatatypeMessageProvider.MSG_FORMAT_FAILURE,
  -                                                                                  DatatypeMessageProvider.MSG_NONE,
  -                                                                                  null));
  -                    }
  +                } else {
  +                    throw new InvalidDatatypeFacetException( getErrorString(  DatatypeMessageProvider.MSG_FORMAT_FAILURE,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                null));
                   }
  +            }
   
  -                isMaxExclusiveDefined = ((fFacetsDefined & 
  -                                          DatatypeValidator.FACET_MAXEXCLUSIVE ) != 0 )?true:false;
  -                isMaxInclusiveDefined = ((fFacetsDefined & 
  -                                          DatatypeValidator.FACET_MAXINCLUSIVE ) != 0 )?true:false;
  -                isMinExclusiveDefined = ((fFacetsDefined &
  -                                          DatatypeValidator.FACET_MINEXCLUSIVE ) != 0 )?true:false;
  -                isMinInclusiveDefined = ((fFacetsDefined &
  -                                          DatatypeValidator.FACET_MININCLUSIVE ) != 0 )?true:false;
  +            isMaxExclusiveDefined = ((fFacetsDefined & 
  +                                        DatatypeValidator.FACET_MAXEXCLUSIVE ) != 0 )?true:false;
  +            isMaxInclusiveDefined = ((fFacetsDefined & 
  +                                        DatatypeValidator.FACET_MAXINCLUSIVE ) != 0 )?true:false;
  +            isMinExclusiveDefined = ((fFacetsDefined &
  +                                        DatatypeValidator.FACET_MINEXCLUSIVE ) != 0 )?true:false;
  +            isMinInclusiveDefined = ((fFacetsDefined &
  +                                        DatatypeValidator.FACET_MININCLUSIVE ) != 0 )?true:false;
   
   
  -                if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
  -                    throw new InvalidDatatypeFacetException(
  -                                                           "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." ); 
  -                }
  -                if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
  -                    throw new InvalidDatatypeFacetException(
  -                                                           "It is an error for both minInclusive and minExclusive to be specified for the same datatype." ); 
  -                }
  +            if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
  +                throw new InvalidDatatypeFacetException(
  +                                                        "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." ); 
  +            }
  +            if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
  +                throw new InvalidDatatypeFacetException(
  +                                                        "It is an error for both minInclusive and minExclusive to be specified for the same datatype." ); 
  +            }
   
  -                if ( (fFacetsDefined & DatatypeValidator.FACET_ENUMERATION ) != 0 ) {
  -                    Vector v = (Vector) facets.get(SchemaSymbols.ELT_ENUMERATION);    
  -                    if (v != null) {
  -                        fEnumrecurringduration = new long[v.size()];
  -                        int     i     = 0;
  -                        String  value = null;
  -                        try {
  -                            for (; i < v.size(); i++){
  -                                value = (String)v.elementAt(i);
  -                                fEnumrecurringduration[i] = 
  -                                normalizeRecurringDuration( value.toCharArray(), 0 );
  -                                boundsCheck( fEnumrecurringduration[i] ); // Check against max,min Inclusive, Exclusives
  -                            }
  -                            if ( fDbug == true ){
  -                                System.out.println( "The enumeration vectory is " + value );
  -                                for ( int enumCounter = 0;
  -                                    enumCounter < this.fEnumrecurringduration.length; enumCounter++ ) {
  -                                    System.out.println( "fEnumrecurringduration[" + enumCounter + "]" );
  -                                }
  +            if ( (fFacetsDefined & DatatypeValidator.FACET_ENUMERATION ) != 0 ) {
  +                Vector v = (Vector) facets.get(SchemaSymbols.ELT_ENUMERATION);    
  +                if (v != null) {
  +                    fEnumrecurringduration = new long[v.size()];
  +                    int     i     = 0;
  +                    String  value = null;
  +                    try {
  +                        for (; i < v.size(); i++){
  +                            value = (String)v.elementAt(i);
  +                            fEnumrecurringduration[i] = 
  +                            normalizeRecurringDuration( value.toCharArray(), 0 );
  +                            boundsCheck( fEnumrecurringduration[i] ); // Check against max,min Inclusive, Exclusives
  +                        }
  +                        if ( fDbug == true ){
  +                            System.out.println( "The enumeration vectory is " + value );
  +                            for ( int enumCounter = 0;
  +                                enumCounter < this.fEnumrecurringduration.length; enumCounter++ ) {
  +                                System.out.println( "fEnumrecurringduration[" + enumCounter + "]" );
                               }
  -                        } catch (InvalidDatatypeValueException idve) {
  -                            throw new InvalidDatatypeFacetException(
  -                                                                   getErrorString(DatatypeMessageProvider.InvalidEnumValue,
  -                                                                                  DatatypeMessageProvider.MSG_NONE,
  -                                                                                  new Object [] { v.elementAt(i)}));
                           }
  +                    } catch (InvalidDatatypeValueException idve) {
  +                        throw new InvalidDatatypeFacetException(
  +                                                                getErrorString(DatatypeMessageProvider.InvalidEnumValue,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                new Object [] { v.elementAt(i)}));
                       }
                   }
  +            }
               
  -             if( fBaseValidator != null ) { // Check if basetype of Period id null
  -                        String value        = null;
  -                        long   baseTypePeriod;
  -                        try {
  -                            Hashtable  baseValidatorFacet = fBaseValidator.getFacets();
  -                            if( baseValidatorFacet != null ) {
  -                                 value         = ((String)baseValidatorFacet.get(SchemaSymbols.ELT_PERIOD ));
  -                                 if( value != null ) {
  -                                      fPeriod       = normalizeRecurringDuration( value.toCharArray(), 0 ); 
  -                                      if( fPeriod == 0 ){
  -                                          isBaseTypeTimePeriod = true;
  -                                      }
  -                                      if ( fDbug == true ){
  -                                          System.out.println( "value = " + value );
  -                                          System.out.println("fPeriod = " + fPeriod );
  -                                      }
  -                                 }
  +            if( fBaseValidator != null ) { // Check if basetype of Period id null
  +                String value        = null;
  +                long   baseTypePeriod;
  +                try {
  +                    Hashtable  baseValidatorFacet = fBaseValidator.getFacets();
  +                    if( baseValidatorFacet != null ) {
  +                            value         = ((String)baseValidatorFacet.get(SchemaSymbols.ELT_PERIOD ));
  +                            if( value != null ) {
  +                                fPeriod       = normalizeRecurringDuration( value.toCharArray(), 0 ); 
  +                                if( fPeriod == 0 ){
  +                                    isBaseTypeTimePeriod = true;
  +                                }
  +                                if ( fDbug == true ){
  +                                    System.out.println( "value = " + value );
  +                                    System.out.println("fPeriod = " + fPeriod );
  +                                }
                               }
  -                        } catch ( InvalidDatatypeValueException nfe ) {
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue,
  -                                                                                   DatatypeMessageProvider.MSG_NONE,
  -                                                                                   new Object [] { value, SchemaSymbols.ELT_PERIOD}));
  -                        }
  -             }
  -
  -
  -
  -            } else { //Derived by List TODO 
  -
  +                    }
  +                } catch ( InvalidDatatypeValueException nfe ) {
  +                    throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                            DatatypeMessageProvider.IllegalFacetValue,
  +                                                                            DatatypeMessageProvider.MSG_NONE,
  +                                                                            new Object [] { value, SchemaSymbols.ELT_PERIOD}));
  +                }
               }
           }// End Facet definition
       }
  @@ -319,48 +309,41 @@
        */
       public Object validate(String content, Object state) throws InvalidDatatypeValueException{
           long normalizedValue;
  -
  -        if ( fDerivedByList == false  ) { //derived by constraint
  -
   
  -            if( fDbug == true ) {
  -                 System.out.println( "Write fFacetsDefined = " + fFacetsDefined );
  -                 if ( ( fFacetsDefined & DatatypeValidator.FACET_DURATION ) != 0 ){
  -                     System.out.println( "Duration = " + this.fDuration );
  -                 }
  -                 if ( ( fFacetsDefined & DatatypeValidator.FACET_PERIOD ) != 0 ){
  -                     System.out.println( "Period = " + this.fPeriod );
  -                 }
  -                 System.out.println("datatype = " + this.fBaseValidator );
  -            }
  -
  -
  -
  -            if ( fPattern != null ) {
  -                RegularExpression regex = new RegularExpression(fPattern, "X" );
  -                if ( regex.matches( content) == false )
  -                    throw new InvalidDatatypeValueException("Value'"+content+
  -                                                            "does not match regular expression facet" + fPattern );
  -            }
  -
  +        if( fDbug == true ) {
  +                System.out.println( "Write fFacetsDefined = " + fFacetsDefined );
  +                if ( ( fFacetsDefined & DatatypeValidator.FACET_DURATION ) != 0 ){
  +                    System.out.println( "Duration = " + this.fDuration );
  +                }
  +                if ( ( fFacetsDefined & DatatypeValidator.FACET_PERIOD ) != 0 ){
  +                    System.out.println( "Period = " + this.fPeriod );
  +                }
  +                System.out.println("datatype = " + this.fBaseValidator );
  +        }
   
  +        if ( fPattern != null ) {
  +            RegularExpression regex = new RegularExpression(fPattern, "X" );
  +            if ( regex.matches( content) == false )
  +                throw new InvalidDatatypeValueException("Value'"+content+
  +                                                        "does not match regular expression facet" + fPattern );
  +        }
   
  -            //normalizeRecurringDuration(content.toCharArray(), 0 );
   
  -            //Calendar cal = normalizeInstant(content.toCharArray(), 0, content.length() ); 
   
  -            //System.out.println( "cal = " + cal.toString() );
  -            //try {
  -            //boundsCheck( normalizedValue );
  -            // } catch( InvalidDatatypeFacetException ex ){
  -            //   throw new InvalidDatatypeValueException( "Boundary error:" );
  -            //}
  +        //normalizeRecurringDuration(content.toCharArray(), 0 );
   
  -            //if ( fEnumrecurringduration != null )
  -            //  enumCheck( normalizedValue );
  +        //Calendar cal = normalizeInstant(content.toCharArray(), 0, content.length() ); 
   
  -        } else { //derived by list 
  -        }
  +        //System.out.println( "cal = " + cal.toString() );
  +        //try {
  +        //boundsCheck( normalizedValue );
  +        // } catch( InvalidDatatypeFacetException ex ){
  +        //   throw new InvalidDatatypeValueException( "Boundary error:" );
  +        //}
  +
  +        //if ( fEnumrecurringduration != null )
  +        //  enumCheck( normalizedValue );
  +        
           return null;
       }
   
  
  
  
  1.17      +79 -187   xml-xerces/java/src/org/apache/xerces/validators/datatype/StringDatatypeValidator.java
  
  Index: StringDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/StringDatatypeValidator.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- StringDatatypeValidator.java	2000/07/31 17:56:52	1.16
  +++ StringDatatypeValidator.java	2000/10/17 00:52:40	1.17
  @@ -73,7 +73,8 @@
    * @author Ted Leung
    * @author Kito D. Mann, Virtua Communications Corp.
    * @author Jeffrey Rodriguez
  - * @version $Id: StringDatatypeValidator.java,v 1.16 2000/07/31 17:56:52 jeffreyr Exp $
  + * @author Mark Swinkles - List Validation refactoring
  + * @version $Id: StringDatatypeValidator.java,v 1.17 2000/10/17 00:52:40 jeffreyr Exp $
    */
   public class StringDatatypeValidator extends AbstractDatatypeValidator{
       private Locale     fLocale          = null;
  @@ -89,7 +90,6 @@
       private String     fMinInclusive     = null;
       private String     fMinExclusive     = null;
       private int        fFacetsDefined    = 0;
  -    private boolean    fDerivedByList    = false;//default
   
       private boolean    isMaxExclusiveDefined = false;
       private boolean    isMaxInclusiveDefined = false;
  @@ -110,157 +110,98 @@
   
           setBasetype( base ); // Set base type 
   
  -        fDerivedByList = derivedByList;
  -
           // Set Facets if any defined
           //fFacetsDefined = 0;
           if ( facets != null  ){
  -            if ( fDerivedByList == false) {
  -
  -                for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  -                    String key = (String) e.nextElement();
  +            for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  +                String key = (String) e.nextElement();
   
  -                    if ( key.equals(SchemaSymbols.ELT_LENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_LENGTH;
  -                        String lengthValue = (String)facets.get(key);
  -                        try {
  -                            fLength     = Integer.parseInt( lengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"' is invalid.");
  -                        }
  -                        if ( fLength < 0 )
  -                            throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"'  must be a nonNegativeInteger.");
  -
  -                    } else if (key.equals(SchemaSymbols.ELT_MINLENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MINLENGTH;
  -                        String minLengthValue = (String)facets.get(key);
  -                        try {
  -                            fMinLength     = Integer.parseInt( minLengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("minLength value '"+minLengthValue+"' is invalid.");
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXLENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXLENGTH;
  -                        String maxLengthValue = (String)facets.get(key);
  -                        try {
  -                            fMaxLength     = Integer.parseInt( maxLengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("maxLength value '"+maxLengthValue+"' is invalid.");
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  -                        fPattern = (String)facets.get(key);
  -                        fRegex   = new RegularExpression(fPattern, "X");
  -                    } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  -                        fEnumeration = (Vector)facets.get(key);
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  -                        fMaxInclusive = (String)facets.get(key);
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXEXCLUSIVE;
  -                        fMaxExclusive = (String)facets.get(key);
  -                    } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  -                        fMinInclusive = (String)facets.get(key);
  -                    } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MINEXCLUSIVE;
  -                        fMinExclusive = (String)facets.get(key);
  -                    } else {
  -                        throw new InvalidDatatypeFacetException("invalid facet tag : " + key);
  +                if ( key.equals(SchemaSymbols.ELT_LENGTH) ) {
  +                    fFacetsDefined += DatatypeValidator.FACET_LENGTH;
  +                    String lengthValue = (String)facets.get(key);
  +                    try {
  +                        fLength     = Integer.parseInt( lengthValue );
  +                    } catch (NumberFormatException nfe) {
  +                        throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"' is invalid.");
                       }
  -                }
  +                    if ( fLength < 0 )
  +                        throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"'  must be a nonNegativeInteger.");
   
  -                if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
  -                    if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "It is an error for both length and maxLength to be members of facets." );  
  -                    } else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "It is an error for both length and minLength to be members of facets." );
  +                } else if (key.equals(SchemaSymbols.ELT_MINLENGTH) ) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MINLENGTH;
  +                    String minLengthValue = (String)facets.get(key);
  +                    try {
  +                        fMinLength     = Integer.parseInt( minLengthValue );
  +                    } catch (NumberFormatException nfe) {
  +                        throw new InvalidDatatypeFacetException("minLength value '"+minLengthValue+"' is invalid.");
                       }
  -                }
  -
  -                if ( ( (fFacetsDefined & ( DatatypeValidator.FACET_MINLENGTH |
  -                                           DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
  -                    if ( fMinLength > fMaxLength ) {
  -                        throw new InvalidDatatypeFacetException( "Value of minLength = '" + fMinLength +
  -                                                                 "'must be less than the value of maxLength = '" + fMaxLength + "'.");
  +                } else if (key.equals(SchemaSymbols.ELT_MAXLENGTH) ) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXLENGTH;
  +                    String maxLengthValue = (String)facets.get(key);
  +                    try {
  +                        fMaxLength     = Integer.parseInt( maxLengthValue );
  +                    } catch (NumberFormatException nfe) {
  +                        throw new InvalidDatatypeFacetException("maxLength value '"+maxLengthValue+"' is invalid.");
                       }
  +                } else if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  +                    fPattern = (String)facets.get(key);
  +                    fRegex   = new RegularExpression(fPattern, "X");
  +                } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  +                    fEnumeration = (Vector)facets.get(key);
  +                } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  +                    fMaxInclusive = (String)facets.get(key);
  +                } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXEXCLUSIVE;
  +                    fMaxExclusive = (String)facets.get(key);
  +                } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  +                    fMinInclusive = (String)facets.get(key);
  +                } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MINEXCLUSIVE;
  +                    fMinExclusive = (String)facets.get(key);
  +                } else {
  +                    throw new InvalidDatatypeFacetException("invalid facet tag : " + key);
                   }
  -
  -                isMaxExclusiveDefined = ((fFacetsDefined & 
  -                                          DatatypeValidator.FACET_MAXEXCLUSIVE ) != 0 )?true:false;
  -                isMaxInclusiveDefined = ((fFacetsDefined & 
  -                                          DatatypeValidator.FACET_MAXINCLUSIVE ) != 0 )?true:false;
  -                isMinExclusiveDefined = ((fFacetsDefined &
  -                                          DatatypeValidator.FACET_MINEXCLUSIVE ) != 0 )?true:false;
  -                isMinInclusiveDefined = ((fFacetsDefined &
  -                                          DatatypeValidator.FACET_MININCLUSIVE ) != 0 )?true:false;
  +            }
   
  -                if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
  +            if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
  +                if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
                       throw new InvalidDatatypeFacetException(
  -                                                           "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." ); 
  -                }
  -                if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
  +                                                            "It is an error for both length and maxLength to be members of facets." );  
  +                } else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
                       throw new InvalidDatatypeFacetException(
  -                                                           "It is an error for both minInclusive and minExclusive to be specified for the same datatype." ); 
  +                                                            "It is an error for both length and minLength to be members of facets." );
                   }
  -            } else { //derived by list
  -                for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  -                    String key = (String) e.nextElement();
  -                    if ( key.equals(SchemaSymbols.ELT_LENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_LENGTH;
  -                        String lengthValue = (String)facets.get(key);
  -                        try {
  -                            fLength     = Integer.parseInt( lengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"' is invalid.");
  -                        }
  -                        if ( fLength < 0 )
  -                            throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"'  must be a nonNegativeInteger.");
  -
  -                    } else if (key.equals(SchemaSymbols.ELT_MINLENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MINLENGTH;
  -                        String minLengthValue = (String)facets.get(key);
  -                        try {
  -                            fMinLength     = Integer.parseInt( minLengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("maxLength value '"+minLengthValue+"' is invalid.");
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXLENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXLENGTH;
  -                        String maxLengthValue = (String)facets.get(key);
  -                        try {
  -                            fMaxLength     = Integer.parseInt( maxLengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("maxLength value '"+maxLengthValue+"' is invalid.");
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  -                        fEnumeration    = (Vector)facets.get(key);
  -                    } else {
  -                        throw new InvalidDatatypeFacetException("invalid facet tag : " + key);
  -                    }
  -                }
  -                if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
  -                    if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "It is an error for both length and maxLength to be members of facets." );  
  -                    } else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "It is an error for both length and minLength to be members of facets." );
  -                    }
  -                }
  +            }
   
  -                if ( ( (fFacetsDefined & ( DatatypeValidator.FACET_MINLENGTH |
  -                                           DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
  -                    if ( fMinLength > fMaxLength ) {
  -                        throw new InvalidDatatypeFacetException( "Value of minLength = " + fMinLength +
  -                                                                 "must be greater that the value of maxLength" + fMaxLength );
  -                    }
  +            if ( ( (fFacetsDefined & ( DatatypeValidator.FACET_MINLENGTH |
  +                                        DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
  +                if ( fMinLength > fMaxLength ) {
  +                    throw new InvalidDatatypeFacetException( "Value of minLength = '" + fMinLength +
  +                                                                "'must be less than the value of maxLength = '" + fMaxLength + "'.");
                   }
               }
  +
  +            isMaxExclusiveDefined = ((fFacetsDefined & 
  +                                        DatatypeValidator.FACET_MAXEXCLUSIVE ) != 0 )?true:false;
  +            isMaxInclusiveDefined = ((fFacetsDefined & 
  +                                        DatatypeValidator.FACET_MAXINCLUSIVE ) != 0 )?true:false;
  +            isMinExclusiveDefined = ((fFacetsDefined &
  +                                        DatatypeValidator.FACET_MINEXCLUSIVE ) != 0 )?true:false;
  +            isMinInclusiveDefined = ((fFacetsDefined &
  +                                        DatatypeValidator.FACET_MININCLUSIVE ) != 0 )?true:false;
  +
  +            if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
  +                throw new InvalidDatatypeFacetException(
  +                                                        "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." ); 
  +            }
  +            if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
  +                throw new InvalidDatatypeFacetException(
  +                                                        "It is an error for both minInclusive and minExclusive to be specified for the same datatype." ); 
  +            }
           }// End of Facets Setting
       }
   
  @@ -278,12 +219,7 @@
        */
       public Object validate(String content, Object state)  throws InvalidDatatypeValueException
       {
  -        if ( fDerivedByList == false  ) {
  -            if (fFacetsDefined != 0 )//Any facets to validate
  -                checkContent( content, state );
  -        } else { //derived by list 
  -            checkContentList( content, state );
  -        }
  +        checkContent( content, state );
           return null;
       }
   
  @@ -414,7 +350,6 @@
               newObj.fMinInclusive     =  this.fMinInclusive;
               newObj.fMinExclusive     =  this.fMinExclusive;
               newObj.fFacetsDefined    =  this.fFacetsDefined;
  -            newObj.fDerivedByList    =  this.fDerivedByList;
               newObj.isMaxExclusiveDefined = this.isMaxExclusiveDefined;
               newObj.isMaxInclusiveDefined = this.isMaxInclusiveDefined;
               newObj.isMinExclusiveDefined = this.isMinExclusiveDefined;
  @@ -426,49 +361,6 @@
       }
   
       // Private methods
  -    private void checkContentList( String content,  Object state )throws InvalidDatatypeValueException
  -    {
  -        StringTokenizer parsedList = new StringTokenizer( content );
  -        try {
  -            int numberOfTokens =  parsedList.countTokens();
  -            if ( (fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH) != 0 ) {
  -                if ( numberOfTokens > fMaxLength ) {
  -                    throw new InvalidDatatypeValueException("Value '"+content+
  -                                                            "' with length ='"+  numberOfTokens + "'tokens"+
  -                                                            "' exceeds maximum length facet with  '"+fMaxLength+"' tokens.");
  -                }
  -            }
  -            if ( (fFacetsDefined & DatatypeValidator.FACET_MINLENGTH) != 0 ) {
  -                if ( numberOfTokens < fMinLength ) {
  -                    throw new InvalidDatatypeValueException("Value '"+content+
  -                                                            "' with length ='"+ numberOfTokens+ "'tokens" +
  -                                                            "' is less than minimum length facet with '"+fMinLength+"' tokens." );
  -                }
  -            }
  -
  -            if ( (fFacetsDefined & DatatypeValidator.FACET_LENGTH) != 0 ) {
  -                if ( numberOfTokens != fLength ) {
  -                    throw new InvalidDatatypeValueException("Value '"+content+
  -                                                            "' with length ='"+ numberOfTokens+ "'tokens" +
  -                                                            "' is not equal to length facet with '"+fLength+"'. tokens");
  -                }
  -            }
  -
  -            if ( (fFacetsDefined & DatatypeValidator.FACET_ENUMERATION) != 0 ) {
  -                if ( fEnumeration.contains( content ) == false )
  -                    throw new InvalidDatatypeValueException("Value '"+
  -                                                            content+"' must be one of "+fEnumeration);
  -            }
  -            while ( parsedList.hasMoreTokens() ) {       //Check actual list content
  -                if ( this.fBaseValidator != null ) {//validate against parent type if any
  -                    this.fBaseValidator.validate( parsedList.nextToken(), state );
  -                }
  -            }
  -        } catch ( NoSuchElementException e ) {
  -            e.printStackTrace();
  -        }
  -    }
  -
       private void setBasetype( DatatypeValidator base) {
           fBaseValidator = base;
       }
  
  
  
  1.6       +119 -130  xml-xerces/java/src/org/apache/xerces/validators/datatype/TimeDurationDatatypeValidator.java
  
  Index: TimeDurationDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/TimeDurationDatatypeValidator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TimeDurationDatatypeValidator.java	2000/08/01 06:06:24	1.5
  +++ TimeDurationDatatypeValidator.java	2000/10/17 00:52:40	1.6
  @@ -72,7 +72,8 @@
    * TimeDurationValidator validates that XML content is a W3C timeDuration.
    *
    * @author Ted Leung, George Joseph
  - * @version $Id: TimeDurationDatatypeValidator.java,v 1.5 2000/08/01 06:06:24 jeffreyr Exp $
  + * @author Mark Swinkles - List Validation refactoring
  + * @version $Id: TimeDurationDatatypeValidator.java,v 1.6 2000/10/17 00:52:40 jeffreyr Exp $
    */
   
   public class TimeDurationDatatypeValidator extends AbstractDatatypeValidator {
  @@ -95,9 +96,6 @@
   
      private int               fFacetsDefined        = 0;
   
  -   private boolean           fDerivedByList        = false;
  -
  -
      private long[]            fEnumTimeDuration = null; // Time duration is represented internally as longs
   
      private DatatypeMessageProvider fMessageProvider = new DatatypeMessageProvider();
  @@ -112,127 +110,121 @@
           if ( base != null )
               setBasetype( base ); // Set base type 
   
  -
  -        fDerivedByList = derivedByList;
           // Set Facets if any defined
   
           if ( facets != null  )  {
  -            if ( fDerivedByList == false ) { // Restriction
  -                if (fBaseValidator != null)
  -                    //if (!fBaseValidator.ensureFacetsAreConsistent(facets))
  -                      //  throw new InvalidDatatypeFacetException(
  -                        //                                       getErrorString( DatatypeMessageProvider.FacetsInconsistent,
  -                          //                                                     DatatypeMessageProvider.MSG_NONE, null));
  -
  -                for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  -
  -                    String key = (String) e.nextElement();
  -
  -                    if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  -                        fPattern = (String)facets.get(key);
  -                    } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  -                        continue; //Treat the enumeration after this for loop
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value         = ((String)facets.get(key));
  -                            fMaxInclusive = normalizeDuration( value.toCharArray(), 0 ); 
  -                        } catch ( InvalidDatatypeValueException nfe ){
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue,
  -                                                                                   DatatypeMessageProvider.MSG_NONE,
  -                                                                                   new Object [] { value, key}));
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXEXCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value         = ((String)facets.get(key));
  -                            fMaxExclusive = normalizeDuration( value.toCharArray(), 0 );
  -                        } catch ( InvalidDatatypeValueException nfe ){
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue,
  -                                                                                   DatatypeMessageProvider.MSG_NONE,
  -                                                                                   new Object [] { value, key}));
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value         = ((String)facets.get(key));
  -                            fMinInclusive = normalizeDuration( value.toCharArray(), 0 );
  -                        } catch ( InvalidDatatypeValueException nfe ){
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue,
  -                                                                                   DatatypeMessageProvider.MSG_NONE,
  -                                                                                   new Object [] { value, key}));
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  -                        String value = null;
  -                        try {
  -                            value         = ((String)facets.get(key));
  -                            fMinExclusive = normalizeDuration( value.toCharArray(), 0 ); 
  -
  -                        } catch ( InvalidDatatypeValueException nfe ) {
  -                            throw new InvalidDatatypeFacetException( getErrorString(
  -                                                                                   DatatypeMessageProvider.IllegalFacetValue,
  -                                                                                   DatatypeMessageProvider.MSG_NONE,
  -                                                                                   new Object [] { value, key}));
  -                        }
  -                    } else {
  -                        throw new InvalidDatatypeFacetException( getErrorString(  DatatypeMessageProvider.MSG_FORMAT_FAILURE,
  -                                                                                  DatatypeMessageProvider.MSG_NONE,
  -                                                                                  null));
  +            if (fBaseValidator != null)
  +                //if (!fBaseValidator.ensureFacetsAreConsistent(facets))
  +                    //  throw new InvalidDatatypeFacetException(
  +                    //                                       getErrorString( DatatypeMessageProvider.FacetsInconsistent,
  +                        //                                                     DatatypeMessageProvider.MSG_NONE, null));
  +
  +            for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  +
  +                String key = (String) e.nextElement();
  +
  +                if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  +                    fPattern = (String)facets.get(key);
  +                } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  +                    continue; //Treat the enumeration after this for loop
  +                } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXINCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value         = ((String)facets.get(key));
  +                        fMaxInclusive = normalizeDuration( value.toCharArray(), 0 ); 
  +                    } catch ( InvalidDatatypeValueException nfe ){
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                new Object [] { value, key}));
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXEXCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value         = ((String)facets.get(key));
  +                        fMaxExclusive = normalizeDuration( value.toCharArray(), 0 );
  +                    } catch ( InvalidDatatypeValueException nfe ){
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                new Object [] { value, key}));
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value         = ((String)facets.get(key));
  +                        fMinInclusive = normalizeDuration( value.toCharArray(), 0 );
  +                    } catch ( InvalidDatatypeValueException nfe ){
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                new Object [] { value, key}));
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MININCLUSIVE;
  +                    String value = null;
  +                    try {
  +                        value         = ((String)facets.get(key));
  +                        fMinExclusive = normalizeDuration( value.toCharArray(), 0 ); 
  +
  +                    } catch ( InvalidDatatypeValueException nfe ) {
  +                        throw new InvalidDatatypeFacetException( getErrorString(
  +                                                                                DatatypeMessageProvider.IllegalFacetValue,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                new Object [] { value, key}));
                       }
  +                } else {
  +                    throw new InvalidDatatypeFacetException( getErrorString(  DatatypeMessageProvider.MSG_FORMAT_FAILURE,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                null));
                   }
  +            }
   
  -                isMaxExclusiveDefined = ((fFacetsDefined & 
  -                                          DatatypeValidator.FACET_MAXEXCLUSIVE ) != 0 )?true:false;
  -                isMaxInclusiveDefined = ((fFacetsDefined & 
  -                                          DatatypeValidator.FACET_MAXINCLUSIVE ) != 0 )?true:false;
  -                isMinExclusiveDefined = ((fFacetsDefined &
  -                                          DatatypeValidator.FACET_MINEXCLUSIVE ) != 0 )?true:false;
  -                isMinInclusiveDefined = ((fFacetsDefined &
  -                                          DatatypeValidator.FACET_MININCLUSIVE ) != 0 )?true:false;
  +            isMaxExclusiveDefined = ((fFacetsDefined & 
  +                                        DatatypeValidator.FACET_MAXEXCLUSIVE ) != 0 )?true:false;
  +            isMaxInclusiveDefined = ((fFacetsDefined & 
  +                                        DatatypeValidator.FACET_MAXINCLUSIVE ) != 0 )?true:false;
  +            isMinExclusiveDefined = ((fFacetsDefined &
  +                                        DatatypeValidator.FACET_MINEXCLUSIVE ) != 0 )?true:false;
  +            isMinInclusiveDefined = ((fFacetsDefined &
  +                                        DatatypeValidator.FACET_MININCLUSIVE ) != 0 )?true:false;
   
   
  -                if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
  -                    throw new InvalidDatatypeFacetException(
  -                                                "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." ); 
  -                }
  -                if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
  -                    throw new InvalidDatatypeFacetException(
  -                                                "It is an error for both minInclusive and minExclusive to be specified for the same datatype." ); 
  -                }
  +            if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
  +                throw new InvalidDatatypeFacetException(
  +                                            "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." ); 
  +            }
  +            if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
  +                throw new InvalidDatatypeFacetException(
  +                                            "It is an error for both minInclusive and minExclusive to be specified for the same datatype." ); 
  +            }
   
   
  -                if ( (fFacetsDefined & DatatypeValidator.FACET_ENUMERATION ) != 0 ) {
  -                    Vector v = (Vector) facets.get(SchemaSymbols.ELT_ENUMERATION);    
  -                    if (v != null) {
  -                        fEnumTimeDuration = new long[v.size()];
  -                        int     i     = 0;
  -                        String  value = null;
  -                        try {
  -                            for (; i < v.size(); i++){
  -                                value = (String)v.elementAt(i);
  -                                fEnumTimeDuration[i] = 
  -                                normalizeDuration( value.toCharArray(),0 );
  -                                boundsCheck(fEnumTimeDuration[i]); // Check against max,min Inclusive, Exclusives
  -                            }
  -                        } catch (InvalidDatatypeValueException idve) {
  -                            throw new InvalidDatatypeFacetException(
  -                                                                   getErrorString(DatatypeMessageProvider.InvalidEnumValue,
  -                                                                                  DatatypeMessageProvider.MSG_NONE,
  -                                                                                  new Object [] { v.elementAt(i)}));
  +            if ( (fFacetsDefined & DatatypeValidator.FACET_ENUMERATION ) != 0 ) {
  +                Vector v = (Vector) facets.get(SchemaSymbols.ELT_ENUMERATION);    
  +                if (v != null) {
  +                    fEnumTimeDuration = new long[v.size()];
  +                    int     i     = 0;
  +                    String  value = null;
  +                    try {
  +                        for (; i < v.size(); i++){
  +                            value = (String)v.elementAt(i);
  +                            fEnumTimeDuration[i] = 
  +                            normalizeDuration( value.toCharArray(),0 );
  +                            boundsCheck(fEnumTimeDuration[i]); // Check against max,min Inclusive, Exclusives
                           }
  +                    } catch (InvalidDatatypeValueException idve) {
  +                        throw new InvalidDatatypeFacetException(
  +                                                                getErrorString(DatatypeMessageProvider.InvalidEnumValue,
  +                                                                                DatatypeMessageProvider.MSG_NONE,
  +                                                                                new Object [] { v.elementAt(i)}));
                       }
                   }
  -            } else { //Derived by List TODO 
  -
               }
           }// End Facet definition
       }
  @@ -252,27 +244,24 @@
       public Object validate(String content, Object state) 
                                          throws InvalidDatatypeValueException{
           long normalizedValue;
  -
  -        if ( fDerivedByList == false  ) { //derived by constraint
  -             if ( fPattern != null ) {
  -                 RegularExpression regex = new RegularExpression(fPattern, "X" );
  -                 if ( regex.matches( content) == false )
  -                     throw new InvalidDatatypeValueException("Value'"+content+
  -                                  "does not match regular expression facet" + fPattern );
  -             }
  -
  -             normalizedValue = normalizeDuration(content.toCharArray(), 0 ); 
  -             try {
  -                 boundsCheck( normalizedValue );
  -             } catch( InvalidDatatypeFacetException ex ){
  -                 throw new InvalidDatatypeValueException( "Boundary Exception" );
  -             }
   
  -             if( fEnumTimeDuration != null )
  -                 enumCheck( normalizedValue );
  +        if ( fPattern != null ) {
  +            RegularExpression regex = new RegularExpression(fPattern, "X" );
  +            if ( regex.matches( content) == false )
  +                throw new InvalidDatatypeValueException("Value'"+content+
  +                            "does not match regular expression facet" + fPattern );
  +        }
   
  -        } else { //derived by list 
  +        normalizedValue = normalizeDuration(content.toCharArray(), 0 ); 
  +        try {
  +            boundsCheck( normalizedValue );
  +        } catch( InvalidDatatypeFacetException ex ){
  +            throw new InvalidDatatypeValueException( "Boundary Exception" );
           }
  +
  +        if( fEnumTimeDuration != null )
  +            enumCheck( normalizedValue );
  +
           return null;
       }
   
  
  
  
  1.10      +68 -146   xml-xerces/java/src/org/apache/xerces/validators/datatype/URIReferenceDatatypeValidator.java
  
  Index: URIReferenceDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/URIReferenceDatatypeValidator.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- URIReferenceDatatypeValidator.java	2000/10/10 21:23:05	1.9
  +++ URIReferenceDatatypeValidator.java	2000/10/17 00:52:40	1.10
  @@ -75,13 +75,13 @@
    * 
    * @author Ted Leung
    * @author Jeffrey Rodriguez
  + * @author Mark Swinkles - List Validation refactoring
    * @see          RFC 2396 
    * @see Tim Berners-Lee, et. al. RFC 2396: Uniform Resource Identifiers (URI): Generic Syntax.. 1998 Available at: http://www.ietf.org/rfc/rfc2396.txt 
  - * @version  $Id: URIReferenceDatatypeValidator.java,v 1.9 2000/10/10 21:23:05 jeffreyr Exp $
  + * @version  $Id: URIReferenceDatatypeValidator.java,v 1.10 2000/10/17 00:52:40 jeffreyr Exp $
    */
   public class URIReferenceDatatypeValidator extends AbstractDatatypeValidator {
       private DatatypeValidator fBaseValidator     = null;
  -    private boolean fDerivedByList               = false;
   
       private int       fLength          = 0;
       private int       fMaxLength       = Integer.MAX_VALUE;
  @@ -99,127 +99,70 @@
   
       public URIReferenceDatatypeValidator ( DatatypeValidator base, Hashtable facets, 
                                              boolean derivedByList ) throws InvalidDatatypeFacetException {
  -        fDerivedByList = derivedByList;
   
           setBasetype( base ); // Set base type 
   
           // Set Facets if any defined
           if ( facets != null  ){
  -            if ( fDerivedByList == false) {
  -                for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  -                    String key = (String) e.nextElement();
  -
  -                    if ( key.equals(SchemaSymbols.ELT_LENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_LENGTH;
  -                        String lengthValue = (String)facets.get(key);
  -                        try {
  -                            fLength     = Integer.parseInt( lengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"' is invalid.");
  -                        }
  -                        if ( fLength < 0 )
  -                            throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"'  must be a nonNegativeInteger.");
  -
  -                    } else if (key.equals(SchemaSymbols.ELT_MINLENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MINLENGTH;
  -                        String minLengthValue = (String)facets.get(key);
  -                        try {
  -                            fMinLength     = Integer.parseInt( minLengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("maxLength value '"+minLengthValue+"' is invalid.");
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXLENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXLENGTH;
  -                        String maxLengthValue = (String)facets.get(key);
  -                        try {
  -                            fMaxLength     = Integer.parseInt( maxLengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("maxLength value '"+maxLengthValue+"' is invalid.");
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  -                        fPattern = (String)facets.get(key);
  -                        if ( fPattern != null )
  -                            fRegex = new RegularExpression(fPattern, "X" );
  -
  -                    } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  -                        fEnumeration = (Vector)facets.get(key);
  -                    } else {
  -                        throw new InvalidDatatypeFacetException();
  -                    }
  -                }
  +            for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  +                String key = (String) e.nextElement();
   
  -                if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
  -                    if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "It is an error for both length and maxLength to be members of facets." );  
  -                    } else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "It is an error for both length and minLength to be members of facets." );
  -                    }
  +                if ( key.equals(SchemaSymbols.ELT_LENGTH) ) {
  +                    fFacetsDefined += DatatypeValidator.FACET_LENGTH;
  +                    String lengthValue = (String)facets.get(key);
  +                    try {
  +                        fLength     = Integer.parseInt( lengthValue );
  +                    } catch (NumberFormatException nfe) {
  +                        throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"' is invalid.");
  +                    }
  +                    if ( fLength < 0 )
  +                        throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"'  must be a nonNegativeInteger.");
  +
  +                } else if (key.equals(SchemaSymbols.ELT_MINLENGTH) ) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MINLENGTH;
  +                    String minLengthValue = (String)facets.get(key);
  +                    try {
  +                        fMinLength     = Integer.parseInt( minLengthValue );
  +                    } catch (NumberFormatException nfe) {
  +                        throw new InvalidDatatypeFacetException("maxLength value '"+minLengthValue+"' is invalid.");
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_MAXLENGTH) ) {
  +                    fFacetsDefined += DatatypeValidator.FACET_MAXLENGTH;
  +                    String maxLengthValue = (String)facets.get(key);
  +                    try {
  +                        fMaxLength     = Integer.parseInt( maxLengthValue );
  +                    } catch (NumberFormatException nfe) {
  +                        throw new InvalidDatatypeFacetException("maxLength value '"+maxLengthValue+"' is invalid.");
  +                    }
  +                } else if (key.equals(SchemaSymbols.ELT_PATTERN)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_PATTERN;
  +                    fPattern = (String)facets.get(key);
  +                    if ( fPattern != null )
  +                        fRegex = new RegularExpression(fPattern, "X" );
  +
  +                } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  +                    fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  +                    fEnumeration = (Vector)facets.get(key);
  +                } else {
  +                    throw new InvalidDatatypeFacetException();
                   }
  +            }
   
  -                if ( ( (fFacetsDefined & ( DatatypeValidator.FACET_MINLENGTH |
  -                                           DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
  -                    if ( fMinLength > fMaxLength ) {
  -                        throw new InvalidDatatypeFacetException( "Value of maxLength = " + fMaxLength +
  -                                                                 "must be greater that the value of minLength" + fMinLength );
  -                    }
  -                }
  -            } else { //derived by list
  -                for (Enumeration e = facets.keys(); e.hasMoreElements();) {
  -                    String key = (String) e.nextElement();
  -                    if ( key.equals(SchemaSymbols.ELT_LENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_LENGTH;
  -                        String lengthValue = (String)facets.get(key);
  -                        try {
  -                            fLength     = Integer.parseInt( lengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"' is invalid.");
  -                        }
  -                        if ( fLength < 0 )
  -                            throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"'  must be a nonNegativeInteger.");
  -
  -                    } else if (key.equals(SchemaSymbols.ELT_MINLENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MINLENGTH;
  -                        String minLengthValue = (String)facets.get(key);
  -                        try {
  -                            fMinLength     = Integer.parseInt( minLengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("maxLength value '"+minLengthValue+"' is invalid.");
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_MAXLENGTH) ) {
  -                        fFacetsDefined += DatatypeValidator.FACET_MAXLENGTH;
  -                        String maxLengthValue = (String)facets.get(key);
  -                        try {
  -                            fMaxLength     = Integer.parseInt( maxLengthValue );
  -                        } catch (NumberFormatException nfe) {
  -                            throw new InvalidDatatypeFacetException("maxLength value '"+maxLengthValue+"' is invalid.");
  -                        }
  -                    } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
  -                        fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
  -                        fEnumeration    = (Vector)facets.get(key);
  -                    } else {
  -                        throw new InvalidDatatypeFacetException();
  -                    }
  +            if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
  +                if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
  +                    throw new InvalidDatatypeFacetException(
  +                                                            "It is an error for both length and maxLength to be members of facets." );  
  +                } else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
  +                    throw new InvalidDatatypeFacetException(
  +                                                            "It is an error for both length and minLength to be members of facets." );
                   }
  -                if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
  -                    if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "It is an error for both length and maxLength to be members of facets." );  
  -                    } else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
  -                        throw new InvalidDatatypeFacetException(
  -                                                               "It is an error for both length and minLength to be members of facets." );
  -                    }
  -                }
  +            }
   
  -                if ( ( (fFacetsDefined & ( DatatypeValidator.FACET_MINLENGTH |
  -                                           DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
  -                    if ( fMinLength > fMaxLength ) {
  -                        throw new InvalidDatatypeFacetException( "Value of maxLength = " + fMinLength +
  -                                                                 "must be greater that the value of minLength" + fMaxLength );
  -                    }
  +            if ( ( (fFacetsDefined & ( DatatypeValidator.FACET_MINLENGTH |
  +                                        DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
  +                if ( fMinLength > fMaxLength ) {
  +                    throw new InvalidDatatypeFacetException( "Value of maxLength = " + fMaxLength +
  +                                                                "must be greater that the value of minLength" + fMinLength );
                   }
               }
           }// End of Facets Setting
  @@ -243,46 +186,26 @@
       {
           StringTokenizer parsedList = null;
           URI             uriContent = null;
  -
  -        if ( fDerivedByList == true  ) { //derived by list
  -
   
  -            parsedList = new StringTokenizer( content );
  -            try {
  -                while ( parsedList.hasMoreTokens() ) {
  -                    //checkContentList( parsedList.nextToken() ); TODO
  -                }
  -            } catch ( NoSuchElementException e ) {
  -                e.printStackTrace();
  -            }
  -        } else { //derived by constraint
  -            // 
  -            if ( (fFacetsDefined & DatatypeValidator.FACET_PATTERN ) != 0 ) {
  -                if ( fRegex == null || fRegex.matches( content) == false )
  -                    throw new InvalidDatatypeValueException("Value '"+content+
  -                                                            "' does not match regular expression facet" + fPattern );
  -            }
  -
  -           
  -            try {
  -                if( content.trim().length() != 0 ) //Validate non null URI 
  -                    uriContent = new URI( content );
  -                //else it is valid anyway
  -                
  -            } catch (  URI.MalformedURIException ex ) {
  +        if ( (fFacetsDefined & DatatypeValidator.FACET_PATTERN ) != 0 ) {
  +            if ( fRegex == null || fRegex.matches( content) == false )
                   throw new InvalidDatatypeValueException("Value '"+content+
  -                                                                           "' is a Malformed URI ");
  -
  -            }
  +                                                        "' does not match regular expression facet" + fPattern );
  +        }
   
  +           
  +        try {
  +            if( content.trim().length() != 0 ) //Validate non null URI 
  +                uriContent = new URI( content );
  +            //else it is valid anyway
  +        } catch (  URI.MalformedURIException ex ) {
  +            throw new InvalidDatatypeValueException("Value '"+content+
  +                                                                        "' is a Malformed URI ");
   
  -            // checkContent( content ); TODO
           }
           return null;
       }
   
  -
  -
       /**
        * Compares two URIReferences for equality.
        * This is not really well defined.
  @@ -316,6 +239,5 @@
       private void setBasetype(DatatypeValidator base) {
           fBaseValidator = base;
       }
  -
   
   }
  
  
  
  1.1                  xml-xerces/java/src/org/apache/xerces/validators/datatype/ListDatatypeValidator.java
  
  Index: ListDatatypeValidator.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999, 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xerces" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.apache.org.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.xerces.validators.datatype;
  
  import java.util.Hashtable;
  import java.util.Vector;
  import java.util.Enumeration;
  import java.util.Locale;
  import java.text.Collator;
  import java.util.Enumeration;
  import java.util.StringTokenizer;
  import java.util.NoSuchElementException;
  import org.apache.xerces.validators.schema.SchemaSymbols;
  import org.apache.xerces.utils.regex.RegularExpression;
  
  /**
   * StringValidator validates that XML content is a W3C string type.
   * @author Jeffrey Rodriguez
   * @author Mark Swinkles - List Validation refactoring
   * @version $Id: ListDatatypeValidator.java,v 1.1 2000/10/17 00:52:39 jeffreyr Exp $
   */
  public class ListDatatypeValidator extends AbstractDatatypeValidator{
      private Locale     fLocale          = null;
      DatatypeValidator  fBaseValidator   = null; // Native datatypes have null
  
      private int        fLength           = 0;
      private int        fMaxLength        = Integer.MAX_VALUE;
      private int        fMinLength        = 0;
      private String     fPattern          = null;
      private Vector     fEnumeration      = null;
      private int        fFacetsDefined    = 0;
      private boolean    fDerivedByList    = false;//default
  
      private RegularExpression fRegex         = null;
  
  
  
  
      public  ListDatatypeValidator () throws InvalidDatatypeFacetException{
          this( null, null, false ); // Native, No Facets defined, Restriction
  
      }
  
      public ListDatatypeValidator ( DatatypeValidator base, Hashtable facets, 
                                       boolean derivedByList ) throws InvalidDatatypeFacetException {
  
          setBasetype( base ); // Set base type 
  
          fDerivedByList = derivedByList;
  
          if ( facets != null  ){
              for (Enumeration e = facets.keys(); e.hasMoreElements();) {
                  String key = (String) e.nextElement();
                  if ( key.equals(SchemaSymbols.ELT_LENGTH) ) {
                      fFacetsDefined += DatatypeValidator.FACET_LENGTH;
                      String lengthValue = (String)facets.get(key);
                      try {
                          fLength     = Integer.parseInt( lengthValue );
                      } catch (NumberFormatException nfe) {
                          throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"' is invalid.");
                      }
                      if ( fLength < 0 )
                          throw new InvalidDatatypeFacetException("Length value '"+lengthValue+"'  must be a nonNegativeInteger.");
  
                  } else if (key.equals(SchemaSymbols.ELT_MINLENGTH) ) {
                      fFacetsDefined += DatatypeValidator.FACET_MINLENGTH;
                      String minLengthValue = (String)facets.get(key);
                      try {
                          fMinLength     = Integer.parseInt( minLengthValue );
                      } catch (NumberFormatException nfe) {
                          throw new InvalidDatatypeFacetException("maxLength value '"+minLengthValue+"' is invalid.");
                      }
                  } else if (key.equals(SchemaSymbols.ELT_MAXLENGTH) ) {
                      fFacetsDefined += DatatypeValidator.FACET_MAXLENGTH;
                      String maxLengthValue = (String)facets.get(key);
                      try {
                          fMaxLength     = Integer.parseInt( maxLengthValue );
                      } catch (NumberFormatException nfe) {
                          throw new InvalidDatatypeFacetException("maxLength value '"+maxLengthValue+"' is invalid.");
                      }
                  } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) {
                      fFacetsDefined += DatatypeValidator.FACET_ENUMERATION;
                      fEnumeration    = (Vector)facets.get(key);
                  } else {
                      throw new InvalidDatatypeFacetException("invalid facet tag : " + key);
                  }
              }
              if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
                  if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
                      throw new InvalidDatatypeFacetException(
                                                              "It is an error for both length and maxLength to be members of facets." );  
                  } else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
                      throw new InvalidDatatypeFacetException(
                                                              "It is an error for both length and minLength to be members of facets." );
                  }
              }
  
              if ( ( (fFacetsDefined & ( DatatypeValidator.FACET_MINLENGTH |
                                          DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
                  if ( fMinLength > fMaxLength ) {
                      throw new InvalidDatatypeFacetException( "Value of minLength = " + fMinLength +
                                                                  "must be greater that the value of maxLength" + fMaxLength );
                  }
              }
          }// End of Facets Setting
      }
  
  
  
  
      /**
       * validate that a string is a W3C string type
       * 
       * @param content A string containing the content to be validated
       * @param list
       * @exception throws InvalidDatatypeException if the content is
       *                   not a W3C string type
       * @exception InvalidDatatypeValueException
       */
      public Object validate(String content, Object state)  throws InvalidDatatypeValueException
      {
          checkContent( content, state );
          return null;
      }
  
  
      /**
       * set the locate to be used for error messages
       */
      public void setLocale(Locale locale) {
          fLocale = locale;
      }
  
  
      /**
       * 
       * @return                          A Hashtable containing the facets
       *         for this datatype.
       */
      public Hashtable getFacets(){
          return null;
      }
  
      public int compare( String content, String facetValue ){
          // if derive by list then this should iterate through
          // the tokens in each string and compare using the base type
          // compare function.
          // if not derived by list just pass the compare down to the
          // base type.
          return 0;
      }
  
      /**
     * Returns a copy of this object.
     */
      public Object clone() throws CloneNotSupportedException  {
          ListDatatypeValidator newObj = null;
          try {
              newObj = new ListDatatypeValidator();
  
              newObj.fLocale           =  this.fLocale;
              newObj.fBaseValidator    =  this.fBaseValidator;
              newObj.fLength           =  this.fLength;
              newObj.fMaxLength        =  this.fMaxLength;
              newObj.fMinLength        =  this.fMinLength;
              newObj.fPattern          =  this.fPattern;
              newObj.fEnumeration      =  this.fEnumeration;
              newObj.fFacetsDefined    =  this.fFacetsDefined;
              newObj.fDerivedByList    =  this.fDerivedByList;
          } catch ( InvalidDatatypeFacetException ex) {
              ex.printStackTrace();
          }
          return newObj;
      }
  
      // Private methods
      private void checkContent( String content,  Object state )throws InvalidDatatypeValueException
      {
          StringTokenizer parsedList = new StringTokenizer( content );
          try {
              int numberOfTokens =  parsedList.countTokens();
              if ( (fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH) != 0 ) {
                  if ( numberOfTokens > fMaxLength ) {
                      throw new InvalidDatatypeValueException("Value '"+content+
                                                              "' with length ='"+  numberOfTokens + "' tokens"+
                                                              "' exceeds maximum length facet of '"+fMaxLength+"' tokens.");
                  }
              }
              if ( (fFacetsDefined & DatatypeValidator.FACET_MINLENGTH) != 0 ) {
                  if ( numberOfTokens < fMinLength ) {
                      throw new InvalidDatatypeValueException("Value '"+content+
                                                              "' with length ='"+ numberOfTokens+ "' tokens" +
                                                              "' is less than minimum length facet of '"+fMinLength+"' tokens." );
                  }
              }
  
              if ( (fFacetsDefined & DatatypeValidator.FACET_LENGTH) != 0 ) {
                  if ( numberOfTokens != fLength ) {
                      throw new InvalidDatatypeValueException("Value '"+content+
                                                              "' with length ='"+ numberOfTokens+ "' tokens" +
                                                              "' is not equal to length facet of '"+fLength+"' tokens.");
                  }
              }
  
              if ( (fFacetsDefined & DatatypeValidator.FACET_ENUMERATION) != 0 ) {
                  // Enumerations are defined in the value space so the contains method
                  // of vector doesn't really do the right thing, we really should check using compare
                  if ( fEnumeration.contains( content ) == false )
                      throw new InvalidDatatypeValueException("Value '"+
                                                              content+"' must be one of "+fEnumeration);
              }
              
              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( content, state );
                  }
              }
                  
          } catch ( NoSuchElementException e ) {
              e.printStackTrace();
          }
      }
  
      private void setBasetype( DatatypeValidator base) {
          fBaseValidator = base;
      }
  
  }