xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r160953 - in xmlbeans/branches/1.x: bin/validate src/typeimpl/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringEnumerationHolderEx.java src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolderEx.java
Date Mon, 11 Apr 2005 21:17:42 GMT
Author: radup
Date: Mon Apr 11 14:17:41 2005
New Revision: 160953

URL: http://svn.apache.org/viewcvs?view=rev&rev=160953
Log:
Integrate r155974 and r155831 in the V1 branch.

Modified:
    xmlbeans/branches/1.x/bin/validate
    xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java
    xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringEnumerationHolderEx.java
    xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolderEx.java

Modified: xmlbeans/branches/1.x/bin/validate
URL: http://svn.apache.org/viewcvs/xmlbeans/branches/1.x/bin/validate?view=diff&r1=160952&r2=160953
==============================================================================
--- xmlbeans/branches/1.x/bin/validate (original)
+++ xmlbeans/branches/1.x/bin/validate Mon Apr 11 14:17:41 2005
@@ -4,7 +4,7 @@
 #
 # Validates an instance against a schema.
 
-CP=
+cp=
 
 if [ -e $XMLBEANS_HOME/build/ar/xbean.jar ]; then
     cp=$cp:$XMLBEANS_HOME/build/ar/xbean.jar;
@@ -14,8 +14,8 @@
 
 case "`uname`" in
     CYGWIN*)
-        CP=`cygpath -w -p $CP`
+        cp=`cygpath -w -p $cp`
         ;;
 esac
 
-java -classpath $CP org.apache.xmlbeans.impl.tool.InstanceValidator $*
+java -classpath $cp org.apache.xmlbeans.impl.tool.InstanceValidator $*

Modified: xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java
URL: http://svn.apache.org/viewcvs/xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java?view=diff&r1=160952&r2=160953
==============================================================================
--- xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java
(original)
+++ xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java
Mon Apr 11 14:17:41 2005
@@ -742,6 +742,11 @@
                             if (fdig.compareValue(myFacets[SchemaType.FACET_FRACTION_DIGITS])
> 0)
                                 state.error("Larger than prior fractionDigits", XmlErrorContext.FACET_VALUE_MALFORMED,
facet);
                         }
+                        if (myFacets[SchemaType.FACET_TOTAL_DIGITS] != null)
+                        {
+                            if (fdig.compareValue(myFacets[SchemaType.FACET_TOTAL_DIGITS])
> 0)
+                                state.error("Larget than prior totalDigits", XmlErrorContext.FACET_VALUE_MALFORMED,
facet);
+                        }
                         myFacets[code] = fdig;
                         break;
 
@@ -761,13 +766,13 @@
                         XmlAnySimpleType limit;
                         try
                         {
-                            limit = baseImpl.newValue(facet.getValue());
+                            limit = baseImpl.newValue(facet.getValue(), true);
                         }
                         catch (XmlValueOutOfRangeException e)
                         {
                             // note: this guarantees that the limit is a valid number in
the
                             // base data type!!
-                            state.error("Must be valid value in base type", XmlErrorContext.FACET_VALUE_MALFORMED,
facet);
+                            state.error("Must be valid value in base type" + e.getMessage(),
XmlErrorContext.FACET_VALUE_MALFORMED, facet);
 
                             // BUGBUG: if there are actual schemas that redefine min/maxExclusive,
                             // they will need this rule relaxed for them!!

Modified: xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringEnumerationHolderEx.java
URL: http://svn.apache.org/viewcvs/xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringEnumerationHolderEx.java?view=diff&r1=160952&r2=160953
==============================================================================
--- xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringEnumerationHolderEx.java
(original)
+++ xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringEnumerationHolderEx.java
Mon Apr 11 14:17:41 2005
@@ -44,17 +44,6 @@
     public static void validateLexical(String v, SchemaType sType, ValidationContext context)
     {
         JavaStringHolderEx.validateLexical(v, sType, context);
-
-        if (sType.hasStringEnumValues())
-        {
-            if (sType.enumForString(v) == null)
-            {
-                if (context != null)
-                {
-                    context.invalid("String '" + v + "' is not a valid enumerated value for
" + QNameHelper.readable(sType));
-                }
-            }
-        }
     }
 
     protected void set_nil()

Modified: xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolderEx.java
URL: http://svn.apache.org/viewcvs/xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolderEx.java?view=diff&r1=160952&r2=160953
==============================================================================
--- xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolderEx.java
(original)
+++ xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolderEx.java
Mon Apr 11 14:17:41 2005
@@ -17,6 +17,7 @@
 
 import org.apache.xmlbeans.SchemaType;
 import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlAnySimpleType;
 import org.apache.xmlbeans.impl.common.ValidationContext;
 import org.apache.xmlbeans.impl.common.QNameHelper;
 
@@ -102,6 +103,23 @@
                         "max length facet (" + m + ") for " + QNameHelper.readable(sType));
                 return;
             }
+        }
+
+        // enumeration
+        // NOTE: can't use .hasStringEnumValues() or .enumForString()
+        // here since we may be validating against a string enum value
+        // during StscSimpleTypeResolver.resolveFacets() and the string
+        // enum table hasn't been constructed yet.
+        XmlAnySimpleType[] vals = sType.getEnumerationValues();
+        if (vals != null)
+        {
+            for (int i = 0; i < vals.length; i++)
+            {
+                if (v.equals(vals[i].getStringValue()))
+                    return;
+            }
+            context.invalid("String value '" + v + "' is not a valid enumeration " +
+                "value for " + QNameHelper.readable(sType));
         }
     }
     



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


Mime
View raw message