diff --git a/src/xercesc/validators/datatype/DecimalDatatypeValidator.cpp b/src/xercesc/validators/datatype/DecimalDatatypeValidator.cpp index 60be2819f64015bde9edebb0c123f9bd23a0592b..668f22aacfe0fdb9122725d34872de408e637f55 100644 --- a/src/xercesc/validators/datatype/DecimalDatatypeValidator.cpp +++ b/src/xercesc/validators/datatype/DecimalDatatypeValidator.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.22 2004/01/03 00:04:36 peiyongz + * using ctor/parseContent to avoid exception thrown from ctor + * * Revision 1.21 2003/12/23 21:50:36 peiyongz * Absorb exception thrown in getCanonicalRepresentation and return 0, * only validate when required @@ -233,8 +236,10 @@ int DecimalDatatypeValidator::compare(const XMLCh* const lValue , const XMLCh* const rValue , MemoryManager* const manager) { - XMLBigDecimal lObj(lValue, manager); - XMLBigDecimal rObj(rValue, manager); + XMLBigDecimal lObj(manager); + lObj.parseContent(lValue); + XMLBigDecimal rObj(manager); + rObj.parseContent(rValue); return compareValues(&lObj, &rObj); } @@ -461,22 +466,26 @@ int DecimalDatatypeValidator::compareValues(const XMLNumber* const lValue void DecimalDatatypeValidator::setMaxInclusive(const XMLCh* const value) { - fMaxInclusive = new (fMemoryManager) XMLBigDecimal(value, fMemoryManager); + fMaxInclusive = new (fMemoryManager) XMLBigDecimal(fMemoryManager); + fMaxInclusive->parseContent(value); } void DecimalDatatypeValidator::setMaxExclusive(const XMLCh* const value) { - fMaxExclusive = new (fMemoryManager) XMLBigDecimal(value, fMemoryManager); + fMaxExclusive = new (fMemoryManager) XMLBigDecimal(fMemoryManager); + fMaxExclusive->parseContent(value); } void DecimalDatatypeValidator::setMinInclusive(const XMLCh* const value) { - fMinInclusive = new (fMemoryManager) XMLBigDecimal(value, fMemoryManager); + fMinInclusive = new (fMemoryManager) XMLBigDecimal(fMemoryManager); + fMinInclusive->parseContent(value); } void DecimalDatatypeValidator::setMinExclusive(const XMLCh* const value) { - fMinExclusive = new (fMemoryManager) XMLBigDecimal(value, fMemoryManager); + fMinExclusive = new (fMemoryManager) XMLBigDecimal(fMemoryManager); + fMinExclusive->parseContent(value); } void DecimalDatatypeValidator::setEnumeration(MemoryManager* const manager) @@ -524,7 +533,9 @@ void DecimalDatatypeValidator::setEnumeration(MemoryManager* const manager) for ( i = 0; i < enumLength; i++) { - fEnumeration->insertElementAt(new (manager) XMLBigDecimal(fStrEnumeration->elementAt(i), manager), i); + XMLBigDecimal *data = new (manager) XMLBigDecimal(manager); + data->parseContent(fStrEnumeration->elementAt(i)); + fEnumeration->insertElementAt(data, i); } } @@ -575,7 +586,8 @@ void DecimalDatatypeValidator::checkContent(const XMLCh* const conte return; try { - XMLBigDecimal compareDataValue(content, manager); + XMLBigDecimal compareDataValue(manager); + compareDataValue.parseContent(content); XMLBigDecimal* compareData = &compareDataValue; if (getEnumeration()) diff --git a/src/xercesc/validators/datatype/DoubleDatatypeValidator.cpp b/src/xercesc/validators/datatype/DoubleDatatypeValidator.cpp index 3c5f36be2526eca0921a16bea853b9f16fe7f1ae..88a747072d78bf4083a22188d0a7ce90caa6d761 100644 --- a/src/xercesc/validators/datatype/DoubleDatatypeValidator.cpp +++ b/src/xercesc/validators/datatype/DoubleDatatypeValidator.cpp @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.11 2004/01/03 00:04:36 peiyongz + * using ctor/parseContent to avoid exception thrown from ctor + * * Revision 1.10 2003/12/17 00:18:38 cargilld * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data. * @@ -150,8 +153,10 @@ int DoubleDatatypeValidator::compare(const XMLCh* const lValue , const XMLCh* const rValue , MemoryManager* const manager) { - XMLDouble lObj(lValue, manager); - XMLDouble rObj(rValue, manager); + XMLDouble lObj(manager); + lObj.parseContent(lValue); + XMLDouble rObj(manager); + rObj.parseContent(rValue); return compareValues(&lObj, &rObj); } @@ -188,22 +193,26 @@ int DoubleDatatypeValidator::compareValues(const XMLNumber* const lValue void DoubleDatatypeValidator::setMaxInclusive(const XMLCh* const value) { - fMaxInclusive = new (fMemoryManager) XMLDouble(value, fMemoryManager); + fMaxInclusive = new (fMemoryManager) XMLDouble(fMemoryManager); + fMaxInclusive->parseContent(value); } void DoubleDatatypeValidator::setMaxExclusive(const XMLCh* const value) { - fMaxExclusive = new (fMemoryManager) XMLDouble(value, fMemoryManager); + fMaxExclusive = new (fMemoryManager) XMLDouble(fMemoryManager); + fMaxExclusive->parseContent(value); } void DoubleDatatypeValidator::setMinInclusive(const XMLCh* const value) { - fMinInclusive = new (fMemoryManager) XMLDouble(value, fMemoryManager); + fMinInclusive = new (fMemoryManager) XMLDouble(fMemoryManager); + fMinInclusive->parseContent(value); } void DoubleDatatypeValidator::setMinExclusive(const XMLCh* const value) { - fMinExclusive = new (fMemoryManager) XMLDouble(value, fMemoryManager); + fMinExclusive = new (fMemoryManager) XMLDouble(fMemoryManager); + fMinExclusive->parseContent(value); } void DoubleDatatypeValidator::setEnumeration(MemoryManager* const manager) @@ -252,7 +261,9 @@ void DoubleDatatypeValidator::setEnumeration(MemoryManager* const manager) for ( i = 0; i < enumLength; i++) { - fEnumeration->insertElementAt(new (manager) XMLDouble(fStrEnumeration->elementAt(i), manager), i); + XMLDouble *data = new (manager) XMLDouble(manager); + data->parseContent(fStrEnumeration->elementAt(i)); + fEnumeration->insertElementAt(data, i); } } @@ -301,7 +312,8 @@ void DoubleDatatypeValidator::checkContent(const XMLCh* const conten return; try { - XMLDouble theValue(content, manager); + XMLDouble theValue(manager); + theValue.parseContent(content); XMLDouble *theData = &theValue; if (getEnumeration()) diff --git a/src/xercesc/validators/datatype/FloatDatatypeValidator.cpp b/src/xercesc/validators/datatype/FloatDatatypeValidator.cpp index 1d36aa7c052d20a23ef9f436a86c35731364c685..209691efff2068e883e17aef9550c30af9c6cf70 100644 --- a/src/xercesc/validators/datatype/FloatDatatypeValidator.cpp +++ b/src/xercesc/validators/datatype/FloatDatatypeValidator.cpp @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.12 2004/01/03 00:04:36 peiyongz + * using ctor/parseContent to avoid exception thrown from ctor + * * Revision 1.11 2003/12/19 23:02:25 cargilld * More memory management updates. * @@ -155,8 +158,10 @@ int FloatDatatypeValidator::compare(const XMLCh* const lValue , const XMLCh* const rValue , MemoryManager* const manager) { - XMLFloat lObj(lValue, manager); - XMLFloat rObj(rValue, manager); + XMLFloat lObj(manager); + lObj.parseContent(lValue); + XMLFloat rObj(manager); + rObj.parseContent(rValue); return compareValues(&lObj, &rObj); } @@ -193,22 +198,26 @@ int FloatDatatypeValidator::compareValues(const XMLNumber* const lValue void FloatDatatypeValidator::setMaxInclusive(const XMLCh* const value) { - fMaxInclusive = new (fMemoryManager) XMLFloat(value, fMemoryManager); + fMaxInclusive = new (fMemoryManager) XMLFloat(fMemoryManager); + fMaxInclusive->parseContent(value); } void FloatDatatypeValidator::setMaxExclusive(const XMLCh* const value) { - fMaxExclusive = new (fMemoryManager) XMLFloat(value, fMemoryManager); + fMaxExclusive = new (fMemoryManager) XMLFloat(fMemoryManager); + fMaxExclusive->parseContent(value); } void FloatDatatypeValidator::setMinInclusive(const XMLCh* const value) { - fMinInclusive = new (fMemoryManager) XMLFloat(value, fMemoryManager); + fMinInclusive = new (fMemoryManager) XMLFloat(fMemoryManager); + fMinInclusive->parseContent(value); } void FloatDatatypeValidator::setMinExclusive(const XMLCh* const value) { - fMinExclusive = new (fMemoryManager) XMLFloat(value, fMemoryManager); + fMinExclusive = new (fMemoryManager) XMLFloat(fMemoryManager); + fMinExclusive->parseContent(value); } void FloatDatatypeValidator::setEnumeration(MemoryManager* const manager) @@ -257,7 +266,9 @@ void FloatDatatypeValidator::setEnumeration(MemoryManager* const manager) for ( i = 0; i < enumLength; i++) { - fEnumeration->insertElementAt(new (fMemoryManager) XMLFloat(fStrEnumeration->elementAt(i), fMemoryManager), i); + XMLFloat *data = new (manager) XMLFloat(manager); + data->parseContent(fStrEnumeration->elementAt(i)); + fEnumeration->insertElementAt(data, i); } } @@ -305,7 +316,8 @@ void FloatDatatypeValidator::checkContent(const XMLCh* const content return; try { - XMLFloat theValue(content, manager); + XMLFloat theValue(manager); + theValue.parseContent(content); XMLFloat *theData = &theValue; if (getEnumeration() != 0)