peiyongz 2004/09/09 13:08:31 Modified: c/src/xercesc/framework/psvi XSValue.hpp XSValue.cpp Log: Using new error code Revision Changes Path 1.10 +9 -4 xml-xerces/c/src/xercesc/framework/psvi/XSValue.hpp Index: XSValue.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSValue.hpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- XSValue.hpp 8 Sep 2004 19:56:05 -0000 1.9 +++ XSValue.hpp 9 Sep 2004 20:08:31 -0000 1.10 @@ -16,6 +16,9 @@ /* * $Log$ + * Revision 1.10 2004/09/09 20:08:31 peiyongz + * Using new error code + * * Revision 1.9 2004/09/08 19:56:05 peiyongz * Remove parameter toValidate from validation interface * @@ -112,13 +115,15 @@ enum Status { st_Init, - st_Invalid, - st_InvalidChar, //for numeric - st_InvalidRange, //for numeric + st_InvalidRange, st_NoCanRep, st_NoActVal, st_NotSupported, st_CantCreateRegEx, + st_FOCA0002, //invalid lexical value + st_FOCA0001, //input value too large for decimal + st_FOCA0003, //input value too large for integer + st_FODT0003, //invalid timezone value st_UnknownType }; 1.10 +74 -27 xml-xerces/c/src/xercesc/framework/psvi/XSValue.cpp Index: XSValue.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSValue.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- XSValue.cpp 8 Sep 2004 19:56:05 -0000 1.9 +++ XSValue.cpp 9 Sep 2004 20:08:31 -0000 1.10 @@ -16,6 +16,9 @@ /* * $Log$ + * Revision 1.10 2004/09/09 20:08:31 peiyongz + * Using new error code + * * Revision 1.9 2004/09/08 19:56:05 peiyongz * Remove parameter toValidate from validation interface * @@ -198,6 +201,17 @@ return sXSValueRegEx; } +inline +static bool checkTimeZoneError(XSValue::DataType const &datatype + , SchemaDateTimeException const &e ) +{ + return (((datatype == XSValue::dt_dateTime) || (datatype == XSValue::dt_time)) && + ((e.getCode() == XMLExcepts::DateTime_tz_noUTCsign) || + (e.getCode() == XMLExcepts::DateTime_tz_stuffAfterZ) || + (e.getCode() == XMLExcepts::DateTime_tz_invalid) || + (e.getCode() == XMLExcepts::DateTime_tz_hh_invalid))); +} + // --------------------------------------------------------------------------- // Local Data // --------------------------------------------------------------------------- @@ -619,7 +633,7 @@ { //getActValue()/getCanonical() need to know the failure details //if validation is required - status = st_InvalidChar; + status = st_FOCA0002; return false; } @@ -673,11 +687,17 @@ return true; //parsing succeed } + catch (SchemaDateTimeException &e) + { + status = checkTimeZoneError(datatype, e)? XSValue::st_FODT0003 : st_FOCA0002; + return false; + } + catch (...) { //getActValue()/getCanonical() need to know the failure details //if validation is required - status = st_Invalid; + status = st_FOCA0002; return false; } @@ -705,7 +725,7 @@ if (i == XMLUni::fgBooleanValueSpaceArraySize) { - status = st_Invalid; + status = st_FOCA0002; return false; } } @@ -714,7 +734,7 @@ { if (HexBin::getDataLength(content) == -1) { - status = st_Invalid; + status = st_FOCA0002; return false; } } @@ -723,7 +743,7 @@ { if (Base64::getDataLength(content, manager) == -1) { - status = st_Invalid; + status = st_FOCA0002; return false; } } @@ -953,7 +973,7 @@ catch (...) { - status = st_Invalid; + status = st_FOCA0002; return false; } @@ -983,7 +1003,7 @@ retVal = XMLBigDecimal::getCanonicalRepresentation(content, manager); if (!retVal) - status = st_InvalidChar; + status = st_FOCA0002; return retVal; @@ -993,7 +1013,7 @@ retVal = XMLAbstractDoubleFloat::getCanonicalRepresentation(content, manager); if (!retVal) - status = st_InvalidChar; + status = st_FOCA0002; return retVal; } @@ -1002,7 +1022,7 @@ retVal = XMLBigInteger::getCanonicalRepresentation(content, manager, datatype == XSValue::dt_nonPositiveInteger); if (!retVal) - status = st_InvalidChar; + status = st_FOCA0002; return retVal; } @@ -1010,7 +1030,7 @@ catch (...) { - status = st_InvalidChar; + status = st_FOCA0002; return 0; } @@ -1050,7 +1070,7 @@ case XSValue::dt_gMonth: { if (toValidate && !validateDateTimes(content, datatype, status, version, manager)) - status = st_Invalid; + status = st_FOCA0002; else status = st_NoCanRep; @@ -1063,9 +1083,15 @@ } } + catch (SchemaDateTimeException &e) + { + status = checkTimeZoneError(datatype, e)? XSValue::st_FODT0003 : st_FOCA0002; + return 0; + } + catch (...) { - status = st_Invalid; + status = st_FOCA0002; return 0; } @@ -1097,7 +1123,7 @@ } else { - status = st_Invalid; + status = st_FOCA0002; return 0; } } @@ -1107,7 +1133,7 @@ //HexBin::getCanonicalRepresentation does validation automatically XMLCh* canRep = HexBin::getCanonicalRepresentation(content, manager); if (!canRep) - status = st_Invalid; + status = st_FOCA0002; return canRep; } @@ -1117,7 +1143,7 @@ //Base64::getCanonicalRepresentation does validation automatically XMLCh* canRep = Base64::getCanonicalRepresentation(content, manager); if (!canRep) - status = st_Invalid; + status = st_FOCA0002; return canRep; } @@ -1140,7 +1166,7 @@ case XSValue::dt_IDREFS: { if (toValidate && !validateStrings(content, datatype, status, version, manager)) - status = st_Invalid; + status = st_FOCA0002; else status = st_NoCanRep; @@ -1155,7 +1181,7 @@ catch (...) { - status = st_Invalid; + status = st_FOCA0002; return 0; } } @@ -1193,7 +1219,12 @@ , manager ) ) + { + if (status != st_FOCA0002) + status = st_FOCA0001; + return 0; + } // get the integer t_value actValInt; @@ -1209,13 +1240,18 @@ , manager ) ) + { + if (status != st_FOCA0002) + status = st_FOCA0001; + return 0; + } //Prepare the double value XMLDouble data2(content, manager); if (data2.isDataConverted()) { - status = st_InvalidRange; + status = data2.isDataOverflowed()? st_FOCA0001 : st_InvalidRange; return 0; } @@ -1282,7 +1318,12 @@ , manager ) ) + { + if (status != st_FOCA0002) + status = st_FOCA0003; + return 0; + } switch (datatype) { @@ -1501,7 +1542,7 @@ catch (...) { - status = st_InvalidChar; + status = st_FOCA0002; return 0; } } @@ -1567,9 +1608,15 @@ return retVal; } + catch (SchemaDateTimeException const &e) + { + status = checkTimeZoneError(datatype, e)? XSValue::st_FODT0003 : st_FOCA0002; + return 0; + } + catch (...) { - status = st_Invalid; + status = st_FOCA0002; return 0; } @@ -1606,7 +1653,7 @@ } else { - status = st_Invalid; + status = st_FOCA0002; return 0; } } @@ -1617,7 +1664,7 @@ if (!decodedData) { - status = st_Invalid; + status = st_FOCA0002; return 0; } @@ -1634,7 +1681,7 @@ if (!decodedData) { - status = st_Invalid; + status = st_FOCA0002; return 0; } @@ -1662,7 +1709,7 @@ case XSValue::dt_IDREFS: { if (toValidate && !validateStrings(content, datatype, status, version, manager)) - status = st_Invalid; + status = st_FOCA0002; else status = st_NoActVal; @@ -1677,7 +1724,7 @@ catch (...) { - status = st_Invalid; + status = st_FOCA0002; return 0; } } @@ -1718,7 +1765,7 @@ // check if all chars are valid char if ( (endptr - nptr) != strLen) { - status = st_InvalidChar; + status = st_FOCA0002; return false; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]