You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2009/12/14 16:04:26 UTC

svn commit: r890358 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: dv/ dv/xs/ msg/ xs/ xs/traversers/

Author: knoaman
Date: Mon Dec 14 15:04:26 2009
New Revision: 890358

URL: http://svn.apache.org/viewvc?rev=890358&view=rev
Log:
Add support for maxScale and minScale (precisionDecimal simple type) - patch by Ken Cai.

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java?rev=890358&r1=890357&r2=890358&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/XSFacets.java Mon Dec 14 15:04:26 2009
@@ -38,7 +38,17 @@
      * value of length facet.
      */
     public int length;
+    
+    /**     
+     * value of maxScale facet.
+     */
+    public int maxScale;
 
+    /**     
+     * value of minScale facet.
+     */
+    public int minScale;
+    
     /**
      * value of minLength facet.
      */
@@ -124,6 +134,8 @@
     public XSAnnotation maxExclusiveAnnotation;
     public XSAnnotation minInclusiveAnnotation;
     public XSAnnotation minExclusiveAnnotation;
+    public XSAnnotation maxScaleAnnotation; //XML Schema 1.1    
+    public XSAnnotation minScaleAnnotation; //XML Schema 1.1   
     public XSAnnotation explicitTimezoneAnnotation; //XML schema 1.1
     
     // the annotations of the assertions are stored in XSAssertImpl objects
@@ -143,6 +155,8 @@
         minInclusiveAnnotation = null;
         minExclusiveAnnotation = null;
         assertFacets = null;
+        maxScaleAnnotation = null;//XML Schema 1.1      
+        minScaleAnnotation = null;//XML Schema 1.1  
         explicitTimezoneAnnotation = null; //XML Schema 1.1
     }
 }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java?rev=890358&r1=890357&r2=890358&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidator.java Mon Dec 14 15:04:26 2009
@@ -102,6 +102,12 @@
         return isDigit(ch) ? ch - '0' : -1;
     }
     
+    //get the number of precision of the value
+    //the parameters are in compiled form (from getActualValue)
+    public int getPrecision(Object value){
+        return 0;
+    }
+    
     public boolean hasTimeZone(Object value){
         return false;
     }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=890358&r1=890357&r2=890358&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java Mon Dec 14 15:04:26 2009
@@ -283,6 +283,8 @@
     private int fMaxLength = -1;
     private int fTotalDigits = -1;
     private int fFractionDigits = -1;
+    private int fMaxScale; //for XML Schema 1.1     
+    private int fMinScale; //for XML Schema 1.1
     private Vector fPattern;
     private Vector fPatternStr;
     private Vector fEnumeration;
@@ -312,6 +314,8 @@
     public XSAnnotation maxExclusiveAnnotation;
     public XSAnnotation minInclusiveAnnotation;
     public XSAnnotation minExclusiveAnnotation;
+    public XSAnnotation maxScaleAnnotation;     
+    public XSAnnotation minScaleAnnotation;   
     public XSAnnotation explicitTimezoneAnnotation;
 
     // facets as objects
@@ -420,6 +424,8 @@
         fPatternType = fBase.fPatternType;
         fFixedFacet = fBase.fFixedFacet;
         fFacetsDefined = fBase.fFacetsDefined;
+        fMaxScale = fBase.fMaxScale;
+        fMinScale = fBase.fMinScale;
         fExplicitTimezone = fBase.fExplicitTimezone;
 
         // always inherit facet annotations in case applyFacets is not called.
@@ -435,6 +441,8 @@
         minInclusiveAnnotation = fBase.minInclusiveAnnotation;
         totalDigitsAnnotation = fBase.totalDigitsAnnotation;
         fractionDigitsAnnotation = fBase.fractionDigitsAnnotation;
+        maxScaleAnnotation = fBase.maxScaleAnnotation;
+        minScaleAnnotation = fBase.minScaleAnnotation;
         explicitTimezoneAnnotation = fBase.explicitTimezoneAnnotation;
 
         //we also set fundamental facets information in case applyFacets is not called.
@@ -543,6 +551,8 @@
         fPatternType = fBase.fPatternType;
         fFixedFacet = fBase.fFixedFacet;
         fFacetsDefined = fBase.fFacetsDefined;
+        fMaxScale = fBase.fMaxScale;
+        fMinScale = fBase.fMinScale;
         fExplicitTimezone = fBase.fExplicitTimezone;
 
         //we also set fundamental facets information in case applyFacets is not called.
@@ -1147,6 +1157,31 @@
             }
         }
 
+        //maxScale      
+        if ((presentFacet & FACET_MAXSCALE) !=0 ){
+            if ((allowedFacet & FACET_MAXSCALE) == 0) {
+                reportError("cos-applicable-facets", new Object[]{"maxScale", fTypeName});
+            }else {
+                maxScaleAnnotation = facets.maxScaleAnnotation;
+                fMaxScale = facets.maxScale;
+                fFacetsDefined |= FACET_MAXSCALE;
+                if ((fixedFacet & FACET_MAXSCALE) != 0)
+                    fFixedFacet |= FACET_MAXSCALE;
+                }
+        }
+        //minScale 
+        if ((presentFacet & FACET_MINSCALE) !=0 ){
+            if ((allowedFacet & FACET_MINSCALE) == 0) {
+                reportError("cos-applicable-facets", new Object[]{"minScale", fTypeName});
+            }else {
+                minScaleAnnotation = facets.minScaleAnnotation;
+                fMinScale = facets.minScale;
+                fFacetsDefined |= FACET_MINSCALE;
+                if ((fixedFacet & FACET_MINSCALE) != 0)
+                    fFixedFacet |= FACET_MINSCALE;
+            }
+        }           
+        
         // token type: internal use, so do less checking
         if (patternType != SPECIAL_PATTERN_NONE) {
             fPatternType = patternType;
@@ -1204,6 +1239,12 @@
                 if (fFractionDigits > fTotalDigits)
                     reportError( "fractionDigits-totalDigits", new Object[]{Integer.toString(fFractionDigits), Integer.toString(fTotalDigits), fTypeName});
             }
+            
+            // check 4.3.14.4 must: minScale <= maxScale           
+            if (((fFacetsDefined & FACET_MAXSCALE) != 0 ) && ((fFacetsDefined & FACET_MINSCALE) != 0)) {
+                if (fMinScale > fMaxScale)
+                    reportError ("minScale-totalDigits", new Object[]{Integer.toString(fMinScale), Integer.toString(fMaxScale), fTypeName});
+            }
 
             // step 3: check facets against base
             // check 4.3.1.c1 error: length & (fBase.maxLength | fBase.minLength)
@@ -1435,7 +1476,43 @@
                     }
                 }
             }
-
+            
+            //check maxScale > fBase.maxScale
+            if ( (fFacetsDefined & FACET_MAXSCALE) != 0 ) {
+                if ( (fBase.fFacetsDefined & FACET_MAXSCALE) != 0 ){
+                    if(( (fBase.fFixedFacet & FACET_MAXSCALE) != 0 )&& fMaxScale != fBase.fMaxScale ) {
+                        reportError( "FixedFacetValue", new Object[]{"maxScale", Integer.toString(fMaxScale), Integer.toString(fBase.fMaxScale), fTypeName});
+                    }
+                    if ( fMaxScale > fBase.fMaxScale) {
+                        reportError( "maxScale-valid-restriction", new Object[]{Integer.toString(fMaxScale), Integer.toString(fBase.fMaxScale), fTypeName});
+                    }
+                }
+            }
+            //check minScale < fBase.minScale
+            if ( (fFacetsDefined & FACET_MINSCALE) != 0 ) {
+                if ( (fBase.fFacetsDefined & FACET_MINSCALE) != 0 ){
+                    if(( (fBase.fFixedFacet & FACET_MINSCALE) != 0 )&& fMinScale != fBase.fMinScale ) {
+                        reportError( "FixedFacetValue", new Object[]{"minScale", Integer.toString(fMinScale), Integer.toString(fBase.fMinScale), fTypeName});
+                    }
+                    if (fMinScale < fBase.fMinScale) {
+                        reportError( "minScale-valid-restriction", new Object[]{Integer.toString(fMinScale), Integer.toString(fBase.fMinScale), fTypeName});
+                    }
+                }
+            }
+            //check must maxScale >= fBase.minScale            
+            if ( ((fFacetsDefined & FACET_MAXSCALE ) != 0 ) && ((fBase.fFacetsDefined & FACET_MINSCALE ) != 0 )) {
+                if ( fMaxScale < fBase.fMinScale) {
+                    reportError ("minScale-totalDigits", new Object[]{Integer.toString(fBase.fMinScale), Integer.toString(fMaxScale), fTypeName});
+                }
+            }
+            
+            //check must minScale <= fBase.maxScale            
+            if ( ((fFacetsDefined & FACET_MINSCALE ) != 0 ) && ((fBase.fFacetsDefined & FACET_MAXSCALE ) != 0 )) {
+                if ( fMinScale > fBase.fMaxScale) {
+                    reportError ("minScale-totalDigits", new Object[]{Integer.toString(fMinScale), Integer.toString(fBase.fMaxScale), fTypeName});
+                }
+            }
+            
             // check 4.3.12.c1 must: fractionDigits <= base.totalDigits
             if ((fFacetsDefined & FACET_FRACTIONDIGITS) != 0) {
                 if ((fBase.fFacetsDefined & FACET_TOTALDIGITS) != 0) {
@@ -1595,6 +1672,22 @@
             fMinInclusive = fBase.fMinInclusive;
             minInclusiveAnnotation = fBase.minInclusiveAnnotation;
         }
+        
+        //inherit maxScale
+        if ((( fBase.fFacetsDefined & FACET_MAXSCALE) != 0) &&
+                !((fFacetsDefined & FACET_MAXSCALE) != 0) && !((fFacetsDefined & FACET_MAXSCALE) != 0)) {
+            fFacetsDefined |= FACET_MAXSCALE;
+            fMaxScale = fBase.fMaxScale;
+            maxScaleAnnotation = fBase.maxScaleAnnotation;
+        }
+        //inherit minScale
+        if ((( fBase.fFacetsDefined & FACET_MINSCALE) != 0) &&
+                !((fFacetsDefined & FACET_MINSCALE) != 0) && !((fFacetsDefined & FACET_MINSCALE) != 0)) {
+            fFacetsDefined |= FACET_MINSCALE;
+            fMinScale = fBase.fMinScale;
+            minScaleAnnotation = fBase.minScaleAnnotation;
+        }
+        
         // inherit totalDigits
         if ((( fBase.fFacetsDefined & FACET_TOTALDIGITS) != 0) &&
                 !((fFacetsDefined & FACET_TOTALDIGITS) != 0)) {
@@ -1820,7 +1913,24 @@
                         new Object[] {content, Integer.toString(totalDigits), Integer.toString(fTotalDigits)});
             }
         }
-
+        
+        //maxScale      
+        if ((fFacetsDefined & FACET_MAXSCALE) != 0) {            
+            int precision = fDVs[fValidationDV].getPrecision(ob);
+            if (precision > fMaxScale){
+                throw new InvalidDatatypeValueException("cvc-maxScale-valid",
+                        new Object[] {content, Integer.toString(fMaxScale), fTypeName, Integer.toString(precision)});
+            }
+        } 
+        
+        //minScale      
+        if ((fFacetsDefined & FACET_MINSCALE) != 0) {            
+            int precision = fDVs[fValidationDV].getPrecision(ob);
+            if (precision < fMinScale){
+                throw new InvalidDatatypeValueException("cvc-minScale-valid",
+                        new Object[] {content, Integer.toString(fMinScale), fTypeName, Integer.toString(precision)} );
+            }
+        }
         
         //explicitTimezone
         if ( ( fFacetsDefined & FACET_EXPLICITTIMEZONE) !=0 ) {
@@ -2316,6 +2426,10 @@
                 return (fMinInclusive == null)?null:fMinInclusive.toString();
             case FACET_TOTALDIGITS:
                 return (fTotalDigits == -1)?null:Integer.toString(fTotalDigits);
+            case FACET_MAXSCALE:
+                return ((fFacetsDefined & FACET_MAXSCALE) == 0)?null:Integer.toString(fMaxScale);
+            case FACET_MINSCALE:
+                return ((fFacetsDefined & FACET_MINSCALE) == 0)?null:Integer.toString(fMinScale);
             case FACET_EXPLICITTIMEZONE:
                 return ET_FACET_STRING[fExplicitTimezone];
             case FACET_FRACTIONDIGITS:
@@ -3110,6 +3224,8 @@
         fMaxExclusive = null;
         fMinExclusive = null;
         fMinInclusive = null;
+        fMaxScale = 0;
+        fMinScale = 0;
         lengthAnnotation = null;
         minLengthAnnotation = null;
         maxLengthAnnotation = null;
@@ -3122,6 +3238,8 @@
         maxExclusiveAnnotation = null;
         minInclusiveAnnotation = null;
         minExclusiveAnnotation = null;
+        maxScaleAnnotation = null;
+        minScaleAnnotation = null;
         explicitTimezoneAnnotation = null;
 
         fPatternType = SPECIAL_PATTERN_NONE;
@@ -3172,7 +3290,7 @@
         if (fFacets == null &&
                 (fFacetsDefined != 0 || fValidationDV == DV_INTEGER)) {
 
-            XSFacetImpl[] facets = new XSFacetImpl[11];
+            XSFacetImpl[] facets = new XSFacetImpl[13];
             int count = 0;
             if ((fFacetsDefined & FACET_WHITESPACE) != 0) {
                 facets[count] =
@@ -3273,15 +3391,24 @@
                             minInclusiveAnnotation);
                 count++;
             }
-            if ((fFacetsDefined & FACET_EXPLICITTIMEZONE) != 0) {
+            if ((fFacetsDefined & FACET_MAXSCALE) != 0) {
                 facets[count] = 
                     new XSFacetImpl (
-                            FACET_EXPLICITTIMEZONE,
-                            ET_FACET_STRING[fExplicitTimezone],
-                            (fFixedFacet & FACET_EXPLICITTIMEZONE) != 0,
-                            explicitTimezoneAnnotation);
+                            FACET_MAXSCALE,
+                            Integer.toString(fMaxScale),
+                            (fFixedFacet & FACET_MAXSCALE) != 0,
+                            maxScaleAnnotation);
                 count++;
             }
+            if ((fFacetsDefined & FACET_MINSCALE) != 0) {
+                facets[count] = 
+                    new XSFacetImpl (
+                            FACET_MINSCALE,
+                            Integer.toString(fMinScale),
+                            (fFixedFacet & FACET_MINSCALE) != 0,
+                            minScaleAnnotation);
+                count++;
+            }           
             fFacets = new XSObjectListImpl(facets, count);
         }
         return (fFacets != null) ? fFacets : XSObjectListImpl.EMPTY_LIST;

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=890358&r1=890357&r2=890358&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties Mon Dec 14 15:04:26 2009
@@ -302,7 +302,12 @@
         whiteSpace-valid-restriction.1 = whiteSpace-valid-restriction.1: In the definition of {0}, the value ''{1}'' for the facet ''whitespace'' is invalid, because the value for ''whitespace'' has been set to ''collapse'' in one of the ancestor types.
         whiteSpace-valid-restriction.2 = whiteSpace-valid-restriction.2: In the definition of {0}, the value ''preserve'' for the facet ''whitespace'' is invalid, because the value for ''whitespace'' has been set to ''replace'' in one of the ancestor types.
 
+		minScale-totalDigits = minScale-totalDigits: In the definition of {2}, value of minScale = ''{0}'' must be <= value of maxScale = ''{1}''.
+		cvc-maxScale-valid = cvc-maxScale-valid: For type {2}, and value {0} , it is an error for the value of precision ''{3}'' to be greater than the value of maxScale ''{1}''.
+		cvc-minScale-valid = cvc-minScale-valid: For type {2}, and value {0} , it is an error for the value of precision ''{3}'' to be less than the value of minScale ''{1}''. 
 		cvc-explicitTimezone-valid = cvc-explicitTimezone-valid: Value ''{0}'' is not facet-valid with respect to explicitTimezone ''{1}'' for type ''{2}''.  
+		maxScale-valid-restriction = maxScale-valid-restriction: In the definition of {2}, maxScale value = ''{0}'' must be <= that of the base type ''{1}''.
+		minScale-valid-restriction = minScale-valid-restriction: In the definition of {2}, minScale value = ''{0}'' must be >= that of the base type ''{1}''.
 		timezone-valid-restriction = timezone-valid-restriction: In the definition of {0}, the value ''{1}'' for the facet ''explicitTimezone'' is invalid, because the value for ''explicitTimezone'' has been set to ''{2}'' in one of the ancestor types.
 	
 #schema for Schemas

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java?rev=890358&r1=890357&r2=890358&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java Mon Dec 14 15:04:26 2009
@@ -80,9 +80,11 @@
     public static final String ELT_MAXEXCLUSIVE           = "maxExclusive".intern();
     public static final String ELT_MAXINCLUSIVE           = "maxInclusive".intern();
     public static final String ELT_MAXLENGTH              = "maxLength".intern();
+    public static final String ELT_MAXSCALE               = "maxScale".intern();
     public static final String ELT_MINEXCLUSIVE           = "minExclusive".intern();
     public static final String ELT_MININCLUSIVE           = "minInclusive".intern();
     public static final String ELT_MINLENGTH              = "minLength".intern();
+    public static final String ELT_MINSCALE               = "minScale".intern();
     public static final String ELT_NOTATION               = "notation".intern();
     public static final String ELT_OPENCONTENT            = "openContent".intern();
     public static final String ELT_PATTERN                = "pattern".intern();

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java?rev=890358&r1=890357&r2=890358&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java Mon Dec 14 15:04:26 2009
@@ -240,6 +240,7 @@
     protected static final int DT_MODE1            = -20;
     protected static final int DT_NOTNAMESPACE     = -21;
     protected static final int DT_NOTQNAME         = -22;
+    protected static final int DT_INT              = -23;
     protected static final int DT_EXPLICITTIMEZONE = -24;
 
     static {
@@ -293,6 +294,7 @@
         int ATT_XML_LANG             = attCount++;
         int ATT_XPATH_R              = attCount++;
         int ATT_XPATH1_R             = attCount++;
+        int ATT_VALUE_INT            = attCount++;
 
         // XML Schema 1.1 attributes
         int ATT_APPLIESTO_EMPTY_D    = attCount++;
@@ -502,7 +504,11 @@
                                                         DT_XPATH1,
                                                         ATTIDX_XPATH,
                                                         null);
-
+        allAttrs[ATT_VALUE_INT]            = new OneAttr(SchemaSymbols.ATT_VALUE,
+                                                        DT_INT,
+                                                        ATTIDX_VALUE,
+                                                        null);
+        
         // XML Schema 1.1
         allAttrs[ATT_APPLIESTO_EMPTY_D]    = new OneAttr(SchemaSymbols.ATT_APPLIESTOEMPTY,
                                                         DT_BOOLEAN,
@@ -884,6 +890,18 @@
         // for element "key" - local
         fEleAttrs11MapL.put(SchemaSymbols.ELT_KEY, attrList);
 
+        // for element "unique", "key", "keyref" with the ref attribute
+        attrList = Container.getContainer(2);
+        // id = ID
+        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
+        // ref = QName        
+        attrList.put(SchemaSymbols.ATT_REF, allAttrs[ATT_REF_R]);
+        fEleAttrs11MapL.put(UNIQUE_R, attrList);
+        // for element "key" with the ref attribute - same list
+        fEleAttrs11MapL.put(KEY_R, attrList);
+        // for element "keyref" with the ref attribute - same list
+        fEleAttrs11MapL.put(KEYREF_R, attrList);
+        
         // for element "keyref" - local
         attrList = Container.getContainer(3);
         // id = ID
@@ -1133,7 +1151,20 @@
         fEleAttrs11MapL.put(SchemaSymbols.ELT_MININCLUSIVE, attrList);
         fEleAttrs11MapL.put(SchemaSymbols.ELT_MINEXCLUSIVE, attrList);
 
-
+        //for element "maxScale", "minScale - local
+        attrList = Container.getContainer(3);
+        //id = ID
+        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
+        // value = integer
+        //attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_INT_N]);
+        attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_INT]);
+        // fixed = boolean : false
+        attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_D]);
+        //for element "maxScale", in Schema 1.1 - local
+        fEleAttrs11MapL.put(SchemaSymbols.ELT_MAXSCALE, attrList);
+        //for element "minScale", in Schema 1.1 - local
+        fEleAttrs11MapL.put(SchemaSymbols.ELT_MINSCALE, attrList);
+        
         // for element "explicitTimezone" - local
         attrList = Container.getContainer(3);
         // id = ID
@@ -2034,6 +2065,23 @@
                 }
             }
             break;
+        case DT_INT:
+            {
+                boolean isPositive = false;
+                try {
+                    if (value.length() > 0 &&  value.charAt(0) == '+') {
+                        isPositive = true;
+                        value = value.substring(1);
+                    }
+                    retValue = fXIntPool.getXInt(Integer.parseInt(value));
+                } catch (NumberFormatException e) {
+                    throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{value, "Integer"});
+                }
+                if (isPositive && (((XInt)retValue).intValue() < 0)) {
+                    throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{"+" + value, "Integer"});
+                }
+            }            
+            break;
         case DT_EXPLICITTIMEZONE:
             // value = optional | required | prohibited
             if (value.equals (SchemaSymbols.ATTVAL_OPTIONAL))

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java?rev=890358&r1=890357&r2=890358&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java Mon Dec 14 15:04:26 2009
@@ -558,6 +558,12 @@
                 else if (facet.equals(SchemaSymbols.ELT_LENGTH)) {
                     currentFacet = XSSimpleType.FACET_LENGTH;
                 }
+                else if (facet.equals(SchemaSymbols.ELT_MAXSCALE)) {  //XML Schema 1.1
+                    currentFacet = XSSimpleType.FACET_MAXSCALE;
+                }
+                else if (facet.equals(SchemaSymbols.ELT_MINSCALE)) {  //XML Schema 1.1
+                    currentFacet = XSSimpleType.FACET_MINSCALE;
+                }
                 else if (facet.equals(SchemaSymbols.ELT_EXPLICITTIMEZONE)){
                     currentFacet = XSSimpleType.FACET_EXPLICITTIMEZONE;
                 }
@@ -627,6 +633,12 @@
                 case XSSimpleType.FACET_LENGTH:
                     xsFacets.length = ((XInt)attrs[XSAttributeChecker.ATTIDX_VALUE]).intValue();
                     break;
+                case XSSimpleType.FACET_MAXSCALE:
+                    xsFacets.maxScale = ((XInt)attrs[XSAttributeChecker.ATTIDX_VALUE]).intValue(); //XML Schema 1.1
+                    break;
+                case XSSimpleType.FACET_MINSCALE:
+                    xsFacets.minScale = ((XInt)attrs[XSAttributeChecker.ATTIDX_VALUE]).intValue(); //XML Schema 1.1
+                    break;
                 case XSSimpleType.FACET_EXPLICITTIMEZONE:
                     xsFacets.explicitTimezone = ((XInt)attrs[XSAttributeChecker.ATTIDX_VALUE]).shortValue();
                     break;
@@ -677,6 +689,12 @@
                 case XSSimpleType.FACET_LENGTH:
                     xsFacets.lengthAnnotation = annotation;
                 break;
+                case XSSimpleType.FACET_MAXSCALE:       //XML Schema 1.1
+                    xsFacets.maxScaleAnnotation = annotation;
+                break;
+                case XSSimpleType.FACET_MINSCALE:       //XML Schema 1.1
+                    xsFacets.minScaleAnnotation = annotation;
+                break;
                 case XSSimpleType.FACET_EXPLICITTIMEZONE:    //XML Schema 1.1
                     xsFacets.explicitTimezoneAnnotation = annotation;
                 break;



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