You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by pe...@apache.org on 2001/10/01 23:03:56 UTC
cvs commit: xml-xerces/c/src/validators/datatype FloatDatatypeValidator.hpp FloatDatatypeValidator.cpp DoubleDatatypeValidator.hpp DoubleDatatypeValidator.cpp
peiyongz 01/10/01 14:03:56
Modified: c/src/validators/datatype FloatDatatypeValidator.hpp
FloatDatatypeValidator.cpp
DoubleDatatypeValidator.hpp
DoubleDatatypeValidator.cpp
Log:
DTV Reorganization:derived from AbstractNumericValidator
Revision Changes Path
1.4 +40 -152 xml-xerces/c/src/validators/datatype/FloatDatatypeValidator.hpp
Index: FloatDatatypeValidator.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/datatype/FloatDatatypeValidator.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FloatDatatypeValidator.hpp 2001/08/24 17:12:01 1.3
+++ FloatDatatypeValidator.hpp 2001/10/01 21:03:55 1.4
@@ -55,8 +55,11 @@
*/
/*
- * $Id: FloatDatatypeValidator.hpp,v 1.3 2001/08/24 17:12:01 knoaman Exp $
+ * $Id: FloatDatatypeValidator.hpp,v 1.4 2001/10/01 21:03:55 peiyongz Exp $
* $Log: FloatDatatypeValidator.hpp,v $
+ * Revision 1.4 2001/10/01 21:03:55 peiyongz
+ * DTV Reorganization:derived from AbstractNumericValidator
+ *
* Revision 1.3 2001/08/24 17:12:01 knoaman
* Add support for anySimpleType.
* Remove parameter 'baseValidator' from the virtual method 'newInstance'.
@@ -74,11 +77,11 @@
#if !defined(FLOAT_DATATYPEVALIDATOR_HPP)
#define FLOAT_DATATYPEVALIDATOR_HPP
-#include <validators/datatype/DatatypeValidator.hpp>
+#include <validators/datatype/AbstractNumericValidator.hpp>
#include <util/RefVectorOf.hpp>
#include <util/XMLFloat.hpp>
-class VALIDATORS_EXPORT FloatDatatypeValidator : public DatatypeValidator
+class VALIDATORS_EXPORT FloatDatatypeValidator : public AbstractNumericValidator
{
public:
@@ -91,33 +94,15 @@
FloatDatatypeValidator();
FloatDatatypeValidator(DatatypeValidator* const baseValidator
- , RefHashTableOf<KVStringPair>* const facets
- , RefVectorOf<XMLCh>* const enums
- , const int finalSet);
+ , RefHashTableOf<KVStringPair>* const facets
+ , RefVectorOf<XMLCh>* const enums
+ , const int finalSet);
virtual ~FloatDatatypeValidator();
//@}
// -----------------------------------------------------------------------
- // Validation methods
- // -----------------------------------------------------------------------
- /** @name Validation Function */
- //@{
-
- /**
- * validate that a string matches the boolean datatype
- * @param content A string containing the content to be validated
- *
- * @exception throws InvalidDatatypeException if the content is
- * is not valid.
- */
-
- void validate(const XMLCh* const content);
-
- //@}
-
- // -----------------------------------------------------------------------
// Compare methods
// -----------------------------------------------------------------------
/** @name Compare Function */
@@ -130,7 +115,7 @@
* @param content2
* @return
*/
- int compare(const XMLCh* const, const XMLCh* const);
+ virtual int compare(const XMLCh* const, const XMLCh* const);
//@}
@@ -138,157 +123,59 @@
* Returns an instance of the base datatype validator class
* Used by the DatatypeValidatorFactory.
*/
- DatatypeValidator* newInstance(RefHashTableOf<KVStringPair>* const facets
- , RefVectorOf<XMLCh>* const enums
- , const int finalSet);
-
-private:
+ virtual DatatypeValidator* newInstance(RefHashTableOf<KVStringPair>* const facets
+ , RefVectorOf<XMLCh>* const enums
+ , const int finalSet);
- void checkContent( const XMLCh* const content, bool asBase);
+protected:
- void init(DatatypeValidator* const baseValidator
- , RefHashTableOf<KVStringPair>* const facets
- , RefVectorOf<XMLCh>* const enums);
-
- void cleanUp();
-
// -----------------------------------------------------------------------
-// Getter methods
+// ctor provided to be used by derived classes
// -----------------------------------------------------------------------
-
- XMLFloat* const getMaxInclusive() const;
-
- XMLFloat* const getMaxExclusive() const;
-
- XMLFloat* const getMinInclusive() const;
-
- XMLFloat* const getMinExclusive() const;
+ FloatDatatypeValidator(DatatypeValidator* const baseValidator
+ , RefHashTableOf<KVStringPair>* const facets
+ , const int finalSet
+ , const ValidatorType type);
- RefVectorOf<XMLFloat>* getEnumeration() const;
+ inline void init(RefVectorOf<XMLCh>* const enums);
// -----------------------------------------------------------------------
-// Setter methods
+// Abstract interface from AbstractNumericFacetValidator
// -----------------------------------------------------------------------
+
+ virtual void assignAdditionalFacet(const XMLCh* const key
+ , const XMLCh* const value);
- void setMaxInclusive(XMLFloat* const);
+ virtual void inheritAdditionalFacet();
- void setMaxExclusive(XMLFloat* const);
+ virtual void checkAdditionalFacetConstraints() const;
- void setMinInclusive(XMLFloat* const);
+ virtual void checkAdditionalFacetConstraintsBase() const;
- void setMinExclusive(XMLFloat* const);
+ virtual int compareValues(const XMLNumber* const lValue
+ , const XMLNumber* const rValue);
- void setEnumeration(RefVectorOf<XMLFloat>* );
+ virtual void setMaxInclusive(const XMLCh* const);
- // -----------------------------------------------------------------------
- // Private data members
- //
- // -----------------------------------------------------------------------
- bool fEnumerationInherited;
+ virtual void setMaxExclusive(const XMLCh* const);
- XMLFloat* fMaxInclusive;
- XMLFloat* fMaxExclusive;
- XMLFloat* fMinInclusive;
- XMLFloat* fMinExclusive;
+ virtual void setMinInclusive(const XMLCh* const);
- RefVectorOf<XMLFloat>* fEnumeration; // save the actual value
+ virtual void setMinExclusive(const XMLCh* const);
-};
+ virtual void setEnumeration();
// -----------------------------------------------------------------------
-// Compare methods
+// Abstract interface from AbstractNumericValidator
// -----------------------------------------------------------------------
-inline int FloatDatatypeValidator::compare(const XMLCh* const lValue
- , const XMLCh* const rValue)
-{
- return XMLFloat::compareValues(new XMLFloat(lValue)
- , new XMLFloat(rValue));
-}
-
-inline DatatypeValidator* FloatDatatypeValidator::newInstance(
- RefHashTableOf<KVStringPair>* const facets
- , RefVectorOf<XMLCh>* const enums
- , const int finalSet)
-{
- return (DatatypeValidator*) new FloatDatatypeValidator(this, facets, enums, finalSet);
-}
-inline void FloatDatatypeValidator::validate( const XMLCh* const content)
-{
- checkContent(content, false);
-}
+ virtual void checkContent( const XMLCh* const content, bool asBase);
-inline void FloatDatatypeValidator::cleanUp()
-{
- delete fMaxInclusive;
- delete fMaxExclusive;
- delete fMinInclusive;
- delete fMinExclusive;
-
- //~RefVectorOf will delete all adopted elements
- if (fEnumeration && !fEnumerationInherited)
- delete fEnumeration;
-}
-
-// -----------------------------------------------------------------------
-// Getter methods
-// -----------------------------------------------------------------------
-inline XMLFloat* const FloatDatatypeValidator::getMaxInclusive() const
-{
- return fMaxInclusive;
-}
-
-inline XMLFloat* const FloatDatatypeValidator::getMaxExclusive() const
-{
- return fMaxExclusive;
-}
-
-inline XMLFloat* const FloatDatatypeValidator::getMinInclusive() const
-{
- return fMinInclusive;
-}
-
-inline XMLFloat* const FloatDatatypeValidator::getMinExclusive() const
-{
- return fMinExclusive;
-}
-
-inline RefVectorOf<XMLFloat>* FloatDatatypeValidator::getEnumeration() const
-{
- return fEnumeration;
-}
-
-// -----------------------------------------------------------------------
-// Setter methods
-// -----------------------------------------------------------------------
-inline void FloatDatatypeValidator::setMaxInclusive(XMLFloat* const newMaxInclusive)
-{
- if (fMaxInclusive) delete fMaxInclusive;
- fMaxInclusive = newMaxInclusive;
-}
-
-inline void FloatDatatypeValidator::setMaxExclusive(XMLFloat* const newMaxExclusive)
-{
- if (fMaxExclusive) delete fMaxExclusive;
- fMaxExclusive = newMaxExclusive;
-}
-
-inline void FloatDatatypeValidator::setMinInclusive(XMLFloat* const newMinInclusive)
-{
- if (fMinInclusive) delete fMinInclusive;
- fMinInclusive = newMinInclusive;
-}
-
-inline void FloatDatatypeValidator::setMinExclusive(XMLFloat* const newMinExclusive)
-{
- if (fMinExclusive) delete fMinExclusive;
- fMinExclusive = newMinExclusive;
-}
+};
-inline void FloatDatatypeValidator::setEnumeration(RefVectorOf<XMLFloat>* newEnum)
+void FloatDatatypeValidator::init(RefVectorOf<XMLCh>* const enums)
{
- if (fEnumeration) delete fEnumeration;
- fEnumeration = newEnum;
+ AbstractNumericValidator::init(enums);
}
/**
1.5 +118 -813 xml-xerces/c/src/validators/datatype/FloatDatatypeValidator.cpp
Index: FloatDatatypeValidator.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/datatype/FloatDatatypeValidator.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FloatDatatypeValidator.cpp 2001/09/20 13:11:42 1.4
+++ FloatDatatypeValidator.cpp 2001/10/01 21:03:55 1.5
@@ -55,8 +55,11 @@
*/
/*
- * $Id: FloatDatatypeValidator.cpp,v 1.4 2001/09/20 13:11:42 knoaman Exp $
+ * $Id: FloatDatatypeValidator.cpp,v 1.5 2001/10/01 21:03:55 peiyongz Exp $
* $Log: FloatDatatypeValidator.cpp,v $
+ * Revision 1.5 2001/10/01 21:03:55 peiyongz
+ * DTV Reorganization:derived from AbstractNumericValidator
+ *
* Revision 1.4 2001/09/20 13:11:42 knoaman
* Regx + misc. fixes
*
@@ -80,787 +83,160 @@
#include <validators/schema/SchemaSymbols.hpp>
#include <validators/datatype/InvalidDatatypeFacetException.hpp>
#include <validators/datatype/InvalidDatatypeValueException.hpp>
-#include <util/NumberFormatException.hpp>
-
-static const int BUF_LEN = 64;
-static XMLCh value1[BUF_LEN+1];
-static XMLCh value2[BUF_LEN+1];
// ---------------------------------------------------------------------------
// Constructors and Destructor
// ---------------------------------------------------------------------------
FloatDatatypeValidator::FloatDatatypeValidator()
-:DatatypeValidator(0, 0, 0, DatatypeValidator::Float)
-, fEnumerationInherited(false)
-, fMaxInclusive(0)
-, fMaxExclusive(0)
-, fMinInclusive(0)
-, fMinExclusive(0)
-, fEnumeration(0)
-{
-}
+:AbstractNumericValidator(0, 0, 0, DatatypeValidator::Float)
+{}
-FloatDatatypeValidator::~FloatDatatypeValidator()
-{
- cleanUp();
-}
-
FloatDatatypeValidator::FloatDatatypeValidator(
DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
-:DatatypeValidator(baseValidator, facets, finalSet, DatatypeValidator::Float)
-, fEnumerationInherited(false)
-, fMaxInclusive(0)
-, fMaxExclusive(0)
-, fMinInclusive(0)
-, fMinExclusive(0)
-, fEnumeration(0)
+:AbstractNumericValidator(baseValidator, facets, finalSet, DatatypeValidator::Float)
{
- try
- {
- init(baseValidator, facets, enums);
- }
-
- catch (...)
- {
- cleanUp();
- throw;
- }
-
+ init(enums);
}
+
+FloatDatatypeValidator::~FloatDatatypeValidator()
+{}
-void FloatDatatypeValidator::init(DatatypeValidator* const baseValidator
- , RefHashTableOf<KVStringPair>* const facets
- , RefVectorOf<XMLCh>* const enums)
+// -----------------------------------------------------------------------
+// Compare methods
+// -----------------------------------------------------------------------
+int FloatDatatypeValidator::compare(const XMLCh* const lValue
+ , const XMLCh* const rValue)
{
- // Set Facets if any defined
- if (facets)
- {
- XMLCh* key;
- XMLCh* value;
- RefVectorOf<XMLCh>* fStrEnumeration = enums; // save the literal value
- Janitor<RefVectorOf<XMLCh> > janStrEnum(fStrEnumeration);
+ XMLFloat * lObj = new XMLFloat(lValue);
+ Janitor<XMLFloat> jname1(lObj);
+ XMLFloat * rObj = new XMLFloat(rValue);
+ Janitor<XMLFloat> jname2(rObj);
- if (enums)
- {
- setFacetsDefined(DatatypeValidator::FACET_ENUMERATION);
- }
+ return compareValues(lObj, rObj);
+}
- RefHashTableOfEnumerator<KVStringPair> e(facets);
+DatatypeValidator* FloatDatatypeValidator::newInstance(
+ RefHashTableOf<KVStringPair>* const facets
+ , RefVectorOf<XMLCh>* const enums
+ , const int finalSet)
+{
+ return (DatatypeValidator*) new FloatDatatypeValidator(this, facets, enums, finalSet);
+}
- while (e.hasMoreElements())
- {
- KVStringPair pair = e.nextElement();
- key = pair.getKey();
- value = pair.getValue();
+// -----------------------------------------------------------------------
+// ctor provided to be used by derived classes
+// -----------------------------------------------------------------------
+FloatDatatypeValidator::FloatDatatypeValidator(DatatypeValidator* const baseValidator
+ , RefHashTableOf<KVStringPair>* const facets
+ , const int finalSet
+ , const ValidatorType type)
+:AbstractNumericValidator(baseValidator, facets, finalSet, type)
+{
+ //do not invoke init here !!!
+}
- if (XMLString::compareString(key, SchemaSymbols::fgELT_PATTERN)==0)
- {
- setPattern(value);
- if (getPattern())
- setFacetsDefined(DatatypeValidator::FACET_PATTERN);
- // do not construct regex until needed
- }
- else if (XMLString::compareString(key, SchemaSymbols::fgELT_MAXINCLUSIVE)==0)
- {
- try
- {
- setMaxInclusive(new XMLFloat(value));
- }
- catch (NumberFormatException)
- {
- ThrowXML1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MaxIncl, value);
- }
- setFacetsDefined(DatatypeValidator::FACET_MAXINCLUSIVE);
- }
- else if (XMLString::compareString(key, SchemaSymbols::fgELT_MAXEXCLUSIVE)==0)
- {
- try
- {
- setMaxExclusive(new XMLFloat(value));
- }
- catch (NumberFormatException)
- {
- ThrowXML1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MaxExcl, value);
- }
- setFacetsDefined(DatatypeValidator::FACET_MAXEXCLUSIVE);
- }
- else if (XMLString::compareString(key, SchemaSymbols::fgELT_MININCLUSIVE)==0)
- {
- try
- {
- setMinInclusive(new XMLFloat(value));
- }
- catch (NumberFormatException)
- {
- ThrowXML1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MinIncl, value);
- }
- setFacetsDefined(DatatypeValidator::FACET_MININCLUSIVE);
- }
- else if (XMLString::compareString(key, SchemaSymbols::fgELT_MINEXCLUSIVE)==0)
- {
- try
- {
- setMinExclusive(new XMLFloat(value));
- }
- catch (NumberFormatException)
- {
- ThrowXML1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MinExcl, value);
- }
- setFacetsDefined(DatatypeValidator::FACET_MINEXCLUSIVE);
- }
- else if (XMLString::compareString(key, SchemaSymbols::fgATT_FIXED)==0)
- {
- unsigned int val;
- bool retStatus;
- try
- {
- retStatus = XMLString::textToBin(value, val);
- }
- catch (RuntimeException)
- {
- ThrowXML(InvalidDatatypeFacetException, XMLExcepts::FACET_internalError_fixed);
- }
-
- if (!retStatus)
- {
- ThrowXML(InvalidDatatypeFacetException, XMLExcepts::FACET_internalError_fixed);
- }
+void FloatDatatypeValidator::assignAdditionalFacet(const XMLCh* const key
+ , const XMLCh* const value)
+{
+ ThrowXML(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_Tag);
+}
- setFixed(val);
- //no setFacetsDefined here
- }
- else
- {
- ThrowXML(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_Tag);
- }
- }//while
+void FloatDatatypeValidator::inheritAdditionalFacet()
+{}
- /***
- Schema constraint: Part I -- self checking
- ***/
+void FloatDatatypeValidator::checkAdditionalFacetConstraints() const
+{}
- try {
+void FloatDatatypeValidator::checkAdditionalFacetConstraintsBase() const
+{}
- if ( getFacetsDefined() != 0 )
- {
- // non co-existence checking
- // check 4.3.8.c1 error: maxInclusive + maxExclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) )
- ThrowXML(InvalidDatatypeFacetException, XMLExcepts::FACET_max_Incl_Excl);
-
- // non co-existence checking
- // check 4.3.9.c1 error: minInclusive + minExclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) )
- ThrowXML(InvalidDatatypeFacetException, XMLExcepts::FACET_min_Incl_Excl);
-
- //
- // minExclusive < minInclusive <= maxInclusive < maxExclusive
- //
- // check 4.3.7.c1 must: minInclusive <= maxInclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) )
- {
- if ( XMLFloat::compareValues(getMinInclusive(), getMaxInclusive()) == 1 )
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_minIncl
- , value2
- , value1);
- }
- }
-
- // check 4.3.8.c2 must: minExclusive <= maxExclusive ??? minExclusive < maxExclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ((getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) )
- {
- if ( XMLFloat::compareValues(getMinExclusive(), getMaxExclusive()) == 1 )
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_minExcl
- , value2
- , value1);
- }
- }
-
- // check 4.3.9.c2 must: minExclusive < maxInclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ((getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) )
- {
- if ( XMLFloat::compareValues(getMinExclusive(), getMaxInclusive()) != -1 )
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_minExcl
- , value2
- , value1);
- }
- }
-
- // check 4.3.10.c1 must: minInclusive < maxExclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) )
- {
- if ( XMLFloat::compareValues(getMinInclusive(), getMaxExclusive()) != -1 )
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_minIncl
- , value2
- , value1);
- }
- }
-
- } // if getFacetsDefined
-
- /***
- Schema constraint: Part II -- self vs base
- ***/
+int FloatDatatypeValidator::compareValues(const XMLNumber* const lValue
+ , const XMLNumber* const rValue)
+{
+ return XMLFloat::compareValues((XMLFloat*) lValue, (XMLFloat*) rValue);
+}
- if ( baseValidator != 0 )
- {
- FloatDatatypeValidator* numBase = (FloatDatatypeValidator*)baseValidator;
+void FloatDatatypeValidator::setMaxInclusive(const XMLCh* const value)
+{
+ fMaxInclusive = new XMLFloat(value);
+}
- // this
- // minExclusive maxExclusive
- // minInclusive maxInclusive
- //
- // base
- // minExclusive maxExclusive
- // minInclusive maxExclusive
- //
- if ( getFacetsDefined() != 0 )
- {
- // check 4.3.7.c2 error:
- // maxInclusive > base.maxInclusive
- // maxInclusive >= base.maxExclusive
- // maxInclusive < base.minInclusive
- // maxInclusive <= base.minExclusive
- // maxInclusive != base.maxInclusive if (base.fixed)
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) )
- {
- if ( ((numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMaxInclusive(), numBase->getMaxInclusive()) == 1 ))
- {
- XMLCh* value1 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_base_maxIncl
- , value1
- , value2);
- }
-
- if ( ((numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMaxInclusive(), numBase->getMaxExclusive()) != -1 ))
- {
- XMLCh* value1 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_base_maxExcl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMaxInclusive(), numBase->getMinInclusive()) == -1 ))
- {
- XMLCh* value1 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_base_minIncl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMaxInclusive(), numBase->getMinExclusive() ) != 1 ))
- {
- XMLCh* value1 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_base_minExcl
- , value1
- , value2);
- }
-
- if ( ((numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ((numBase->getFixed() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMaxInclusive(), numBase->getMaxInclusive()) != 0 ))
- {
- XMLCh* value1 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_base_fixed
- , value1
- , value2);
- }
- }
-
- // check 4.3.8.c3 error:
- // maxExclusive > base.maxExclusive
- // maxExclusive > base.maxInclusive
- // maxExclusive <= base.minInclusive
- // maxExclusive <= base.minExclusive
- // maxExclusive != base.maxExclusive if (base.fixed)
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) )
- {
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMaxExclusive(), numBase->getMaxExclusive()) == 1 ))
- {
- XMLCh* value1 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_base_maxExcl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMaxExclusive(), numBase->getMaxInclusive()) == 1 ))
- {
- XMLCh* value1 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_base_maxIncl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMaxExclusive(), numBase->getMinExclusive() ) != 1 ))
- {
- XMLCh* value1 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_base_minExcl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMaxExclusive(), numBase->getMinInclusive()) != 1 ))
- {
- XMLCh* value1 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_base_minExcl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- (( numBase->getFixed() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMaxExclusive(), numBase->getMaxExclusive()) != 0 ))
- {
- XMLCh* value1 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_base_fixed
- , value1
- , value2);
- }
- }
-
- // check 4.3.9.c3 error:
- // minExclusive < base.minExclusive
- // minExclusive > base.maxInclusive ??? minExclusive >= base.maxInclusive
- // minExclusive < base.minInclusive
- // minExclusive >= base.maxExclusive
- // minExclusive != base.minExclusive if (base.fixed)
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) )
- {
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMinExclusive(), numBase->getMinExclusive() ) == -1 ))
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minExcl_base_minExcl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMinExclusive(), numBase->getMaxInclusive()) == 1 ))
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minExcl_base_maxIncl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMinExclusive(), numBase->getMinInclusive()) == -1 ))
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minExcl_base_minIncl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMinExclusive(), numBase->getMaxExclusive()) != -1 ))
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minExcl_base_maxExcl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- (( numBase->getFixed() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMinExclusive(), numBase->getMinExclusive() ) != 0 ))
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minExcl_base_fixed
- , value1
- , value2);
- }
- }
-
- // check 4.3.10.c2 error:
- // minInclusive < base.minInclusive
- // minInclusive > base.maxInclusive
- // minInclusive <= base.minExclusive
- // minInclusive >= base.maxExclusive
- // minInclusive != base.minInclusive if (base.fixed)
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) )
- {
- if ( ((numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMinInclusive(), numBase->getMinInclusive()) == -1 ))
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minIncl_base_minIncl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMinInclusive(), numBase->getMaxInclusive()) == 1 ))
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minIncl_base_maxIncl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMinInclusive(), numBase->getMinExclusive() ) != 1 ))
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minIncl_base_minExcl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMinInclusive(), numBase->getMaxExclusive()) != -1 ))
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minIncl_base_maxExcl
- , value1
- , value2);
- }
-
- if ( ((numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- ((numBase->getFixed() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- ( XMLFloat::compareValues(getMinInclusive(), numBase->getMinInclusive()) != 0 ))
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minIncl_base_fixed
- , value1
- , value2);
- }
-
- }
-
-
-
- // check question error: totalDigits conflicts with bounds ???
-
- // check 4.3.5.c0 must: enumeration values from the value space of base
- //
- // In fact, the values in the enumeration shall go through validation
- // of this class as well.
- // this->checkContent(value, false);
- //
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) != 0) &&
- ( fStrEnumeration != 0 ))
- {
- int i;
- int enumLength = fStrEnumeration->size();
- try
- {
- for ( i = 0; i < enumLength; i++)
- {
- // ask parent do a complete check
- numBase->checkContent(fStrEnumeration->elementAt(i), false);
- // shall pass this->checkContent() as well
- checkContent(fStrEnumeration->elementAt(i), false);
- }
-
- }
-
- catch ( XMLException& )
- {
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_enum_base
- , fStrEnumeration->elementAt(i));
- }
-
- //
- // we need to convert from fStrEnumeration to fEnumeration
- try
- {
- fEnumeration = new RefVectorOf<XMLFloat>(enumLength, true);
- fEnumerationInherited = false;
- for ( i = 0; i < enumLength; i++)
- fEnumeration->insertElementAt(new XMLFloat(fStrEnumeration->elementAt(i)), i);
-
- }
- catch ( NumberFormatException& )
- {
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_enum_base
- , fStrEnumeration->elementAt(i));
- }
-
- }
-
- //
- // maxInclusive
- // maxExclusive
- // minInclusive
- // minExclusive
- // shall come from the base's value space as well
- //
- if ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0)
- {
- try
- {
- // ask parent do a complete check
- numBase->checkContent(getMaxInclusive()->toString(), false);
- }
- catch ( XMLException& )
- {
- XMLCh* value1 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan(value1);
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_notFromBase
- , value1
- );
- }
- }
-
- if ((getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0)
- {
- try
- {
- // ask parent do a complete check
- numBase->checkContent(getMaxExclusive()->toString(), false);
- }
- catch ( XMLException& )
- {
- XMLCh* value1 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan(value1);
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_notFromBase
- , value1
- );
- }
- }
-
- if ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0)
- {
- try
- {
- // ask parent do a complete check
- numBase->checkContent(getMinInclusive()->toString(), false);
- }
- catch ( XMLException& )
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan(value1);
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minIncl_notFromBase
- , value1
- );
- }
- }
-
- if ((getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0)
- {
- try
- {
- // ask parent do a complete check
- numBase->checkContent(getMinExclusive()->toString(), false);
- }
- catch ( XMLException& )
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan(value1);
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minExcl_notFromBase
- , value1
- );
- }
- }
+void FloatDatatypeValidator::setMaxExclusive(const XMLCh* const value)
+{
+ fMaxExclusive = new XMLFloat(value);
+}
- }
+void FloatDatatypeValidator::setMinInclusive(const XMLCh* const value)
+{
+ fMinInclusive = new XMLFloat(value);
+}
- } //if baseValidator
- }
- catch (XMLException &e)
- {
- ThrowXML1(InvalidDatatypeFacetException, XMLExcepts::RethrowError, e.getMessage());
- }
+void FloatDatatypeValidator::setMinExclusive(const XMLCh* const value)
+{
+ fMinExclusive = new XMLFloat(value);
+}
- }// End of Facet setting
+void FloatDatatypeValidator::setEnumeration()
+{
+ // check 4.3.5.c0 must: enumeration values from the value space of base
+ //
+ // 1. shall be from base value space
+ // 2. shall be from current value space as well ( shall go through boundsCheck() )
+ //
+ if (!fStrEnumeration)
+ return;
+ int i = 0;
+ int enumLength = fStrEnumeration->size();
- /***
- Schema constraint: Part III -- inherit from base
- ***/
- if ( baseValidator )
- {
- FloatDatatypeValidator* numBase = (FloatDatatypeValidator*)baseValidator;
- // inherit enumeration
- if ((( numBase->getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) !=0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) == 0))
- {
- fEnumeration = numBase->getEnumeration();
- fEnumerationInherited = true;
- setFacetsDefined(DatatypeValidator::FACET_ENUMERATION);
- }
+ FloatDatatypeValidator *numBase = (FloatDatatypeValidator*) getBaseValidator();
+ if (numBase)
+ {
+ try
+ {
+ for ( i = 0; i < enumLength; i++)
+ {
+ numBase->checkContent(fStrEnumeration->elementAt(i), false);
+ }
+ }
+ catch (XMLException&)
+ {
+ ThrowXML1(InvalidDatatypeFacetException
+ , XMLExcepts::FACET_enum_base
+ , fStrEnumeration->elementAt(i));
- // inherit maxExclusive
- if ((( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) == 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) == 0) )
- {
- setMaxExclusive(new XMLFloat(*(numBase->getMaxExclusive())));
- setFacetsDefined(DatatypeValidator::FACET_MAXEXCLUSIVE);
- }
-
- // inherit maxInclusive
- if ((( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) == 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) == 0) )
- {
- setMaxInclusive(new XMLFloat(*(numBase->getMaxInclusive())));
- setFacetsDefined(DatatypeValidator::FACET_MAXINCLUSIVE);
}
+ }
- // inherit minExclusive
- if ((( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) == 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) == 0) )
- {
- setMinExclusive(new XMLFloat(*(numBase->getMinExclusive())));
- setFacetsDefined(DatatypeValidator::FACET_MINEXCLUSIVE);
- }
-
- // inherit minExclusive
- if ((( numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) == 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) == 0) )
- {
- setMinInclusive(new XMLFloat(*(numBase->getMinInclusive())));
- setFacetsDefined(DatatypeValidator::FACET_MININCLUSIVE);
- }
+ // We put the this->checkContent in a separate loop
+ // to not block original message with in that method.
+ //
+ for ( i = 0; i < enumLength; i++)
+ {
+ checkContent(fStrEnumeration->elementAt(i), false);
+ }
-
- // inherit "fixed" option
- setFixed(getFixed() | numBase->getFixed());
-
- }
+ fEnumeration = new RefVectorOf<XMLNumber>(enumLength, true);
+ fEnumerationInherited = false;
+ for ( i = 0; i < enumLength; i++)
+ {
+ fEnumeration->insertElementAt(new XMLFloat(fStrEnumeration->elementAt(i)), i);
+ }
}
+// -----------------------------------------------------------------------
+// Abstract interface from AbstractNumericValidator
+// -----------------------------------------------------------------------
void FloatDatatypeValidator::checkContent( const XMLCh* const content, bool asBase)
{
- char *p = XMLString::transcode(content);
-
//validate against base validator if any
FloatDatatypeValidator *pBase = (FloatDatatypeValidator*) this->getBaseValidator();
- if (pBase !=0)
+ if (pBase)
pBase->checkContent(content, true);
// we check pattern first
@@ -901,7 +277,7 @@
int enumLength = getEnumeration()->size();
for ( ; i < enumLength; i++)
{
- if (XMLFloat::compareValues(theData, getEnumeration()->elementAt(i))==0)
+ if (compareValues(theData, (XMLFloat*) getEnumeration()->elementAt(i))==0)
break;
}
@@ -909,70 +285,7 @@
ThrowXML1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content);
}
- if ( (getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0 )
- {
- // must be < MaxExclusive
- if (XMLFloat::compareValues(theData, getMaxExclusive()) != -1)
- {
- XMLCh* value1 = theData->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::VALUE_exceed_maxExcl
- , value1
- , value2);
- }
- }
-
- if ( (getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0 )
- {
- // must be <= MaxInclusive
- if (XMLFloat::compareValues(theData, getMaxInclusive()) == 1)
- {
- XMLCh* value1 = theData->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::VALUE_exceed_maxIncl
- , value1
- , value2);
-
- }
- }
-
- if ( (getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0 )
- {
- // must be >= MinInclusive
- if (XMLFloat::compareValues(theData, getMinInclusive()) == -1)
- {
- XMLCh* value1 = theData->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::VALUE_exceed_minIncl
- , value1
- , value2);
- }
- }
-
- if ( (getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0 )
- {
- // must be > MinExclusive
- if (XMLFloat::compareValues(theData, getMinExclusive()) != 1)
- {
- XMLCh* value1 = theData->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::VALUE_exceed_minExcl
- , value1
- , value2);
- }
- }
+ boundsCheck(theData);
}
catch (XMLException &e)
{
@@ -981,14 +294,6 @@
}
-
-
-// ---------------------------------------------------------------------------
-// Whitespace handling methods
-// ---------------------------------------------------------------------------
-
-
/**
* End of file FloatDatatypeValidator::cpp
*/
-
1.4 +40 -152 xml-xerces/c/src/validators/datatype/DoubleDatatypeValidator.hpp
Index: DoubleDatatypeValidator.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/datatype/DoubleDatatypeValidator.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DoubleDatatypeValidator.hpp 2001/08/24 17:12:01 1.3
+++ DoubleDatatypeValidator.hpp 2001/10/01 21:03:55 1.4
@@ -55,8 +55,11 @@
*/
/*
- * $Id: DoubleDatatypeValidator.hpp,v 1.3 2001/08/24 17:12:01 knoaman Exp $
+ * $Id: DoubleDatatypeValidator.hpp,v 1.4 2001/10/01 21:03:55 peiyongz Exp $
* $Log: DoubleDatatypeValidator.hpp,v $
+ * Revision 1.4 2001/10/01 21:03:55 peiyongz
+ * DTV Reorganization:derived from AbstractNumericValidator
+ *
* Revision 1.3 2001/08/24 17:12:01 knoaman
* Add support for anySimpleType.
* Remove parameter 'baseValidator' from the virtual method 'newInstance'.
@@ -73,11 +76,11 @@
#if !defined(DOUBLE_DATATYPEVALIDATOR_HPP)
#define DOUBLE_DATATYPEVALIDATOR_HPP
-#include <validators/datatype/DatatypeValidator.hpp>
+#include <validators/datatype/AbstractNumericValidator.hpp>
#include <util/RefVectorOf.hpp>
#include <util/XMLDouble.hpp>
-class VALIDATORS_EXPORT DoubleDatatypeValidator : public DatatypeValidator
+class VALIDATORS_EXPORT DoubleDatatypeValidator : public AbstractNumericValidator
{
public:
@@ -90,33 +93,15 @@
DoubleDatatypeValidator();
DoubleDatatypeValidator(DatatypeValidator* const baseValidator
- , RefHashTableOf<KVStringPair>* const facets
- , RefVectorOf<XMLCh>* const enums
- , const int finalSet);
+ , RefHashTableOf<KVStringPair>* const facets
+ , RefVectorOf<XMLCh>* const enums
+ , const int finalSet);
virtual ~DoubleDatatypeValidator();
//@}
// -----------------------------------------------------------------------
- // Validation methods
- // -----------------------------------------------------------------------
- /** @name Validation Function */
- //@{
-
- /**
- * validate that a string matches the boolean datatype
- * @param content A string containing the content to be validated
- *
- * @exception throws InvalidDatatypeException if the content is
- * is not valid.
- */
-
- void validate(const XMLCh* const content);
-
- //@}
-
- // -----------------------------------------------------------------------
// Compare methods
// -----------------------------------------------------------------------
/** @name Compare Function */
@@ -129,7 +114,7 @@
* @param content2
* @return
*/
- int compare(const XMLCh* const, const XMLCh* const);
+ virtual int compare(const XMLCh* const, const XMLCh* const);
//@}
@@ -137,157 +122,59 @@
* Returns an instance of the base datatype validator class
* Used by the DatatypeValidatorFactory.
*/
- DatatypeValidator* newInstance(RefHashTableOf<KVStringPair>* const facets
- , RefVectorOf<XMLCh>* const enums
- , const int finalSet);
-
-private:
+ virtual DatatypeValidator* newInstance(RefHashTableOf<KVStringPair>* const facets
+ , RefVectorOf<XMLCh>* const enums
+ , const int finalSet);
- void checkContent( const XMLCh* const content, bool asBase);
+protected:
- void init(DatatypeValidator* const baseValidator
- , RefHashTableOf<KVStringPair>* const facets
- , RefVectorOf<XMLCh>* const enums);
-
- void cleanUp();
-
// -----------------------------------------------------------------------
-// Getter methods
+// ctor provided to be used by derived classes
// -----------------------------------------------------------------------
-
- XMLDouble* const getMaxInclusive() const;
-
- XMLDouble* const getMaxExclusive() const;
-
- XMLDouble* const getMinInclusive() const;
-
- XMLDouble* const getMinExclusive() const;
+ DoubleDatatypeValidator(DatatypeValidator* const baseValidator
+ , RefHashTableOf<KVStringPair>* const facets
+ , const int finalSet
+ , const ValidatorType type);
- RefVectorOf<XMLDouble>* getEnumeration() const;
+ inline void init(RefVectorOf<XMLCh>* const enums);
// -----------------------------------------------------------------------
-// Setter methods
+// Abstract interface from AbstractNumericFacetValidator
// -----------------------------------------------------------------------
+
+ virtual void assignAdditionalFacet(const XMLCh* const key
+ , const XMLCh* const value);
- void setMaxInclusive(XMLDouble* const);
+ virtual void inheritAdditionalFacet();
- void setMaxExclusive(XMLDouble* const);
+ virtual void checkAdditionalFacetConstraints() const;
- void setMinInclusive(XMLDouble* const);
+ virtual void checkAdditionalFacetConstraintsBase() const;
- void setMinExclusive(XMLDouble* const);
+ virtual int compareValues(const XMLNumber* const lValue
+ , const XMLNumber* const rValue);
- void setEnumeration(RefVectorOf<XMLDouble>* );
+ virtual void setMaxInclusive(const XMLCh* const);
- // -----------------------------------------------------------------------
- // Private data members
- //
- // -----------------------------------------------------------------------
- bool fEnumerationInherited;
+ virtual void setMaxExclusive(const XMLCh* const);
- XMLDouble* fMaxInclusive;
- XMLDouble* fMaxExclusive;
- XMLDouble* fMinInclusive;
- XMLDouble* fMinExclusive;
+ virtual void setMinInclusive(const XMLCh* const);
- RefVectorOf<XMLDouble>* fEnumeration; // save the actual value
+ virtual void setMinExclusive(const XMLCh* const);
-};
+ virtual void setEnumeration();
// -----------------------------------------------------------------------
-// Compare methods
+// Abstract interface from AbstractNumericValidator
// -----------------------------------------------------------------------
-inline int DoubleDatatypeValidator::compare(const XMLCh* const lValue
- , const XMLCh* const rValue)
-{
- return XMLDouble::compareValues(new XMLDouble(lValue)
- , new XMLDouble(rValue));
-}
-
-inline DatatypeValidator* DoubleDatatypeValidator::newInstance(
- RefHashTableOf<KVStringPair>* const facets
- , RefVectorOf<XMLCh>* const enums
- , const int finalSet)
-{
- return (DatatypeValidator*) new DoubleDatatypeValidator(this, facets, enums, finalSet);
-}
-inline void DoubleDatatypeValidator::validate( const XMLCh* const content)
-{
- checkContent(content, false);
-}
+ virtual void checkContent( const XMLCh* const content, bool asBase);
-inline void DoubleDatatypeValidator::cleanUp()
-{
- delete fMaxInclusive;
- delete fMaxExclusive;
- delete fMinInclusive;
- delete fMinExclusive;
-
- //~RefVectorOf will delete all adopted elements
- if (fEnumeration && !fEnumerationInherited)
- delete fEnumeration;
-}
-
-// -----------------------------------------------------------------------
-// Getter methods
-// -----------------------------------------------------------------------
-inline XMLDouble* const DoubleDatatypeValidator::getMaxInclusive() const
-{
- return fMaxInclusive;
-}
-
-inline XMLDouble* const DoubleDatatypeValidator::getMaxExclusive() const
-{
- return fMaxExclusive;
-}
-
-inline XMLDouble* const DoubleDatatypeValidator::getMinInclusive() const
-{
- return fMinInclusive;
-}
-
-inline XMLDouble* const DoubleDatatypeValidator::getMinExclusive() const
-{
- return fMinExclusive;
-}
-
-inline RefVectorOf<XMLDouble>* DoubleDatatypeValidator::getEnumeration() const
-{
- return fEnumeration;
-}
-
-// -----------------------------------------------------------------------
-// Setter methods
-// -----------------------------------------------------------------------
-inline void DoubleDatatypeValidator::setMaxInclusive(XMLDouble* const newMaxInclusive)
-{
- if (fMaxInclusive) delete fMaxInclusive;
- fMaxInclusive = newMaxInclusive;
-}
-
-inline void DoubleDatatypeValidator::setMaxExclusive(XMLDouble* const newMaxExclusive)
-{
- if (fMaxExclusive) delete fMaxExclusive;
- fMaxExclusive = newMaxExclusive;
-}
-
-inline void DoubleDatatypeValidator::setMinInclusive(XMLDouble* const newMinInclusive)
-{
- if (fMinInclusive) delete fMinInclusive;
- fMinInclusive = newMinInclusive;
-}
-
-inline void DoubleDatatypeValidator::setMinExclusive(XMLDouble* const newMinExclusive)
-{
- if (fMinExclusive) delete fMinExclusive;
- fMinExclusive = newMinExclusive;
-}
+};
-inline void DoubleDatatypeValidator::setEnumeration(RefVectorOf<XMLDouble>* newEnum)
+void DoubleDatatypeValidator::init(RefVectorOf<XMLCh>* const enums)
{
- if (fEnumeration) delete fEnumeration;
- fEnumeration = newEnum;
+ AbstractNumericValidator::init(enums);
}
/**
1.5 +120 -813 xml-xerces/c/src/validators/datatype/DoubleDatatypeValidator.cpp
Index: DoubleDatatypeValidator.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/datatype/DoubleDatatypeValidator.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DoubleDatatypeValidator.cpp 2001/09/20 13:11:42 1.4
+++ DoubleDatatypeValidator.cpp 2001/10/01 21:03:55 1.5
@@ -55,8 +55,11 @@
*/
/*
- * $Id: DoubleDatatypeValidator.cpp,v 1.4 2001/09/20 13:11:42 knoaman Exp $
+ * $Id: DoubleDatatypeValidator.cpp,v 1.5 2001/10/01 21:03:55 peiyongz Exp $
* $Log: DoubleDatatypeValidator.cpp,v $
+ * Revision 1.5 2001/10/01 21:03:55 peiyongz
+ * DTV Reorganization:derived from AbstractNumericValidator
+ *
* Revision 1.4 2001/09/20 13:11:42 knoaman
* Regx + misc. fixes
*
@@ -79,787 +82,161 @@
#include <validators/schema/SchemaSymbols.hpp>
#include <validators/datatype/InvalidDatatypeFacetException.hpp>
#include <validators/datatype/InvalidDatatypeValueException.hpp>
-#include <util/NumberFormatException.hpp>
-
-static const int BUF_LEN = 64;
-static XMLCh value1[BUF_LEN+1];
-static XMLCh value2[BUF_LEN+1];
// ---------------------------------------------------------------------------
// Constructors and Destructor
// ---------------------------------------------------------------------------
DoubleDatatypeValidator::DoubleDatatypeValidator()
-:DatatypeValidator(0, 0, 0, DatatypeValidator::Double)
-, fEnumerationInherited(false)
-, fMaxInclusive(0)
-, fMaxExclusive(0)
-, fMinInclusive(0)
-, fMinExclusive(0)
-, fEnumeration(0)
-{
-}
+:AbstractNumericValidator(0, 0, 0, DatatypeValidator::Double)
+{}
-DoubleDatatypeValidator::~DoubleDatatypeValidator()
-{
- cleanUp();
-}
-
DoubleDatatypeValidator::DoubleDatatypeValidator(
DatatypeValidator* const baseValidator
, RefHashTableOf<KVStringPair>* const facets
, RefVectorOf<XMLCh>* const enums
, const int finalSet)
-:DatatypeValidator(baseValidator, facets, finalSet, DatatypeValidator::Double)
-, fEnumerationInherited(false)
-, fMaxInclusive(0)
-, fMaxExclusive(0)
-, fMinInclusive(0)
-, fMinExclusive(0)
-, fEnumeration(0)
+:AbstractNumericValidator(baseValidator, facets, finalSet, DatatypeValidator::Double)
{
- try
- {
- init(baseValidator, facets, enums);
- }
-
- catch (...)
- {
- cleanUp();
- throw;
- }
-
+ init(enums);
}
+
+DoubleDatatypeValidator::~DoubleDatatypeValidator()
+{}
-void DoubleDatatypeValidator::init(DatatypeValidator* const baseValidator
- , RefHashTableOf<KVStringPair>* const facets
- , RefVectorOf<XMLCh>* const enums)
+// -----------------------------------------------------------------------
+// Compare methods
+// -----------------------------------------------------------------------
+int DoubleDatatypeValidator::compare(const XMLCh* const lValue
+ , const XMLCh* const rValue)
{
- // Set Facets if any defined
- if (facets)
- {
- XMLCh* key;
- XMLCh* value;
- RefVectorOf<XMLCh>* fStrEnumeration = enums; // save the literal value
- Janitor<RefVectorOf<XMLCh> > janStrEnum(fStrEnumeration);
+ XMLDouble * lObj = new XMLDouble(lValue);
+ Janitor<XMLDouble> jname1(lObj);
+ XMLDouble * rObj = new XMLDouble(rValue);
+ Janitor<XMLDouble> jname2(rObj);
- if (enums)
- {
- setFacetsDefined(DatatypeValidator::FACET_ENUMERATION);
- }
+ return compareValues(lObj, rObj);
+}
- RefHashTableOfEnumerator<KVStringPair> e(facets);
+DatatypeValidator* DoubleDatatypeValidator::newInstance(
+ RefHashTableOf<KVStringPair>* const facets
+ , RefVectorOf<XMLCh>* const enums
+ , const int finalSet)
+{
+ return (DatatypeValidator*) new DoubleDatatypeValidator(this, facets, enums, finalSet);
+}
- while (e.hasMoreElements())
- {
- KVStringPair pair = e.nextElement();
- key = pair.getKey();
- value = pair.getValue();
+// -----------------------------------------------------------------------
+// ctor provided to be used by derived classes
+// -----------------------------------------------------------------------
+DoubleDatatypeValidator::DoubleDatatypeValidator(DatatypeValidator* const baseValidator
+ , RefHashTableOf<KVStringPair>* const facets
+ , const int finalSet
+ , const ValidatorType type)
+:AbstractNumericValidator(baseValidator, facets, finalSet, type)
+{
+ //do not invoke init here !!!
+}
- if (XMLString::compareString(key, SchemaSymbols::fgELT_PATTERN)==0)
- {
- setPattern(value);
- if (getPattern())
- setFacetsDefined(DatatypeValidator::FACET_PATTERN);
- // do not construct regex until needed
- }
- else if (XMLString::compareString(key, SchemaSymbols::fgELT_MAXINCLUSIVE)==0)
- {
- try
- {
- setMaxInclusive(new XMLDouble(value));
- }
- catch (NumberFormatException)
- {
- ThrowXML1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MaxIncl, value);
- }
- setFacetsDefined(DatatypeValidator::FACET_MAXINCLUSIVE);
- }
- else if (XMLString::compareString(key, SchemaSymbols::fgELT_MAXEXCLUSIVE)==0)
- {
- try
- {
- setMaxExclusive(new XMLDouble(value));
- }
- catch (NumberFormatException)
- {
- ThrowXML1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MaxExcl, value);
- }
- setFacetsDefined(DatatypeValidator::FACET_MAXEXCLUSIVE);
- }
- else if (XMLString::compareString(key, SchemaSymbols::fgELT_MININCLUSIVE)==0)
- {
- try
- {
- setMinInclusive(new XMLDouble(value));
- }
- catch (NumberFormatException)
- {
- ThrowXML1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MinIncl, value);
- }
- setFacetsDefined(DatatypeValidator::FACET_MININCLUSIVE);
- }
- else if (XMLString::compareString(key, SchemaSymbols::fgELT_MINEXCLUSIVE)==0)
- {
- try
- {
- setMinExclusive(new XMLDouble(value));
- }
- catch (NumberFormatException)
- {
- ThrowXML1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MinExcl, value);
- }
- setFacetsDefined(DatatypeValidator::FACET_MINEXCLUSIVE);
- }
- else if (XMLString::compareString(key, SchemaSymbols::fgATT_FIXED)==0)
- {
- unsigned int val;
- bool retStatus;
- try
- {
- retStatus = XMLString::textToBin(value, val);
- }
- catch (RuntimeException)
- {
- ThrowXML(InvalidDatatypeFacetException, XMLExcepts::FACET_internalError_fixed);
- }
-
- if (!retStatus)
- {
- ThrowXML(InvalidDatatypeFacetException, XMLExcepts::FACET_internalError_fixed);
- }
+void DoubleDatatypeValidator::assignAdditionalFacet(const XMLCh* const key
+ , const XMLCh* const value)
+{
+ ThrowXML(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_Tag);
+}
- setFixed(val);
- //no setFacetsDefined here
- }
- else
- {
- ThrowXML(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_Tag);
- }
- }//while
+void DoubleDatatypeValidator::inheritAdditionalFacet()
+{}
- /***
- Schema constraint: Part I -- self checking
- ***/
+void DoubleDatatypeValidator::checkAdditionalFacetConstraints() const
+{}
- try {
+void DoubleDatatypeValidator::checkAdditionalFacetConstraintsBase() const
+{}
- if ( getFacetsDefined() != 0 )
- {
- // non co-existence checking
- // check 4.3.8.c1 error: maxInclusive + maxExclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) )
- ThrowXML(InvalidDatatypeFacetException, XMLExcepts::FACET_max_Incl_Excl);
-
- // non co-existence checking
- // check 4.3.9.c1 error: minInclusive + minExclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) )
- ThrowXML(InvalidDatatypeFacetException, XMLExcepts::FACET_min_Incl_Excl);
-
- //
- // minExclusive < minInclusive <= maxInclusive < maxExclusive
- //
- // check 4.3.7.c1 must: minInclusive <= maxInclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) )
- {
- if ( XMLDouble::compareValues(getMinInclusive(), getMaxInclusive()) == 1 )
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_minIncl
- , value2
- , value1);
- }
- }
-
- // check 4.3.8.c2 must: minExclusive <= maxExclusive ??? minExclusive < maxExclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ((getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) )
- {
- if ( XMLDouble::compareValues(getMinExclusive(), getMaxExclusive()) == 1 )
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_minExcl
- , value2
- , value1);
- }
- }
-
- // check 4.3.9.c2 must: minExclusive < maxInclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ((getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) )
- {
- if ( XMLDouble::compareValues(getMinExclusive(), getMaxInclusive()) != -1 )
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_minExcl
- , value2
- , value1);
- }
- }
-
- // check 4.3.10.c1 must: minInclusive < maxExclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) )
- {
- if ( XMLDouble::compareValues(getMinInclusive(), getMaxExclusive()) != -1 )
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_minIncl
- , value2
- , value1);
- }
- }
-
- } // if getFacetsDefined
-
- /***
- Schema constraint: Part II -- self vs base
- ***/
+int DoubleDatatypeValidator::compareValues(const XMLNumber* const lValue
+ , const XMLNumber* const rValue)
+{
+ return XMLDouble::compareValues((XMLDouble*) lValue, (XMLDouble*) rValue);
+}
- if ( baseValidator != 0 )
- {
- DoubleDatatypeValidator* numBase = (DoubleDatatypeValidator*)baseValidator;
+void DoubleDatatypeValidator::setMaxInclusive(const XMLCh* const value)
+{
+ fMaxInclusive = new XMLDouble(value);
+}
- // this
- // minExclusive maxExclusive
- // minInclusive maxInclusive
- //
- // base
- // minExclusive maxExclusive
- // minInclusive maxExclusive
- //
- if ( getFacetsDefined() != 0 )
- {
- // check 4.3.7.c2 error:
- // maxInclusive > base.maxInclusive
- // maxInclusive >= base.maxExclusive
- // maxInclusive < base.minInclusive
- // maxInclusive <= base.minExclusive
- // maxInclusive != base.maxInclusive if (base.fixed)
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) )
- {
- if ( ((numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMaxInclusive(), numBase->getMaxInclusive()) == 1 ))
- {
- XMLCh* value1 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_base_maxIncl
- , value1
- , value2);
- }
-
- if ( ((numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMaxInclusive(), numBase->getMaxExclusive()) != -1 ))
- {
- XMLCh* value1 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_base_maxExcl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMaxInclusive(), numBase->getMinInclusive()) == -1 ))
- {
- XMLCh* value1 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_base_minIncl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMaxInclusive(), numBase->getMinExclusive() ) != 1 ))
- {
- XMLCh* value1 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_base_minExcl
- , value1
- , value2);
- }
-
- if ( ((numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ((numBase->getFixed() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMaxInclusive(), numBase->getMaxInclusive()) != 0 ))
- {
- XMLCh* value1 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_base_fixed
- , value1
- , value2);
- }
- }
-
- // check 4.3.8.c3 error:
- // maxExclusive > base.maxExclusive
- // maxExclusive > base.maxInclusive
- // maxExclusive <= base.minInclusive
- // maxExclusive <= base.minExclusive
- // maxExclusive != base.maxExclusive if (base.fixed)
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) )
- {
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMaxExclusive(), numBase->getMaxExclusive()) == 1 ))
- {
- XMLCh* value1 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_base_maxExcl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMaxExclusive(), numBase->getMaxInclusive()) == 1 ))
- {
- XMLCh* value1 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_base_maxIncl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMaxExclusive(), numBase->getMinExclusive() ) != 1 ))
- {
- XMLCh* value1 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_base_minExcl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMaxExclusive(), numBase->getMinInclusive()) != 1 ))
- {
- XMLCh* value1 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_base_minExcl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- (( numBase->getFixed() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMaxExclusive(), numBase->getMaxExclusive()) != 0 ))
- {
- XMLCh* value1 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_base_fixed
- , value1
- , value2);
- }
- }
-
- // check 4.3.9.c3 error:
- // minExclusive < base.minExclusive
- // minExclusive > base.maxInclusive ??? minExclusive >= base.maxInclusive
- // minExclusive < base.minInclusive
- // minExclusive >= base.maxExclusive
- // minExclusive != base.minExclusive if (base.fixed)
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) )
- {
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMinExclusive(), numBase->getMinExclusive() ) == -1 ))
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minExcl_base_minExcl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMinExclusive(), numBase->getMaxInclusive()) == 1 ))
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minExcl_base_maxIncl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMinExclusive(), numBase->getMinInclusive()) == -1 ))
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minExcl_base_minIncl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMinExclusive(), numBase->getMaxExclusive()) != -1 ))
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minExcl_base_maxExcl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- (( numBase->getFixed() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMinExclusive(), numBase->getMinExclusive() ) != 0 ))
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minExcl_base_fixed
- , value1
- , value2);
- }
- }
-
- // check 4.3.10.c2 error:
- // minInclusive < base.minInclusive
- // minInclusive > base.maxInclusive
- // minInclusive <= base.minExclusive
- // minInclusive >= base.maxExclusive
- // minInclusive != base.minInclusive if (base.fixed)
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) )
- {
- if ( ((numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMinInclusive(), numBase->getMinInclusive()) == -1 ))
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minIncl_base_minIncl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMinInclusive(), numBase->getMaxInclusive()) == 1 ))
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minIncl_base_maxIncl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMinInclusive(), numBase->getMinExclusive() ) != 1 ))
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minIncl_base_minExcl
- , value1
- , value2);
- }
-
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMinInclusive(), numBase->getMaxExclusive()) != -1 ))
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minIncl_base_maxExcl
- , value1
- , value2);
- }
-
- if ( ((numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- ((numBase->getFixed() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- ( XMLDouble::compareValues(getMinInclusive(), numBase->getMinInclusive()) != 0 ))
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minIncl_base_fixed
- , value1
- , value2);
- }
-
- }
-
-
-
- // check question error: totalDigits conflicts with bounds ???
-
- // check 4.3.5.c0 must: enumeration values from the value space of base
- //
- // In fact, the values in the enumeration shall go through validation
- // of this class as well.
- // this->checkContent(value, false);
- //
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) != 0) &&
- ( fStrEnumeration != 0 ))
- {
- int i;
- int enumLength = fStrEnumeration->size();
- try
- {
- for ( i = 0; i < enumLength; i++)
- {
- // ask parent do a complete check
- numBase->checkContent(fStrEnumeration->elementAt(i), false);
- // shall pass this->checkContent() as well
- checkContent(fStrEnumeration->elementAt(i), false);
- }
-
- }
-
- catch ( XMLException& )
- {
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_enum_base
- , fStrEnumeration->elementAt(i));
- }
-
- //
- // we need to convert from fStrEnumeration to fEnumeration
- try
- {
- fEnumeration = new RefVectorOf<XMLDouble>(enumLength, true);
- fEnumerationInherited = false;
- for ( i = 0; i < enumLength; i++)
- fEnumeration->insertElementAt(new XMLDouble(fStrEnumeration->elementAt(i)), i);
-
- }
- catch ( NumberFormatException& )
- {
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_enum_base
- , fStrEnumeration->elementAt(i));
- }
-
- }
-
- //
- // maxInclusive
- // maxExclusive
- // minInclusive
- // minExclusive
- // shall come from the base's value space as well
- //
- if ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0)
- {
- try
- {
- // ask parent do a complete check
- numBase->checkContent(getMaxInclusive()->toString(), false);
- }
- catch ( XMLException& )
- {
- XMLCh* value1 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan(value1);
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_notFromBase
- , value1
- );
- }
- }
-
- if ((getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0)
- {
- try
- {
- // ask parent do a complete check
- numBase->checkContent(getMaxExclusive()->toString(), false);
- }
- catch ( XMLException& )
- {
- XMLCh* value1 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan(value1);
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_notFromBase
- , value1
- );
- }
- }
-
- if ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0)
- {
- try
- {
- // ask parent do a complete check
- numBase->checkContent(getMinInclusive()->toString(), false);
- }
- catch ( XMLException& )
- {
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan(value1);
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minIncl_notFromBase
- , value1
- );
- }
- }
-
- if ((getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0)
- {
- try
- {
- // ask parent do a complete check
- numBase->checkContent(getMinExclusive()->toString(), false);
- }
- catch ( XMLException& )
- {
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan(value1);
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minExcl_notFromBase
- , value1
- );
- }
- }
+void DoubleDatatypeValidator::setMaxExclusive(const XMLCh* const value)
+{
+ fMaxExclusive = new XMLDouble(value);
+}
- }
+void DoubleDatatypeValidator::setMinInclusive(const XMLCh* const value)
+{
+ fMinInclusive = new XMLDouble(value);
+}
- } //if baseValidator
- }
- catch (XMLException &e)
- {
- ThrowXML1(InvalidDatatypeFacetException, XMLExcepts::RethrowError, e.getMessage());
- }
+void DoubleDatatypeValidator::setMinExclusive(const XMLCh* const value)
+{
+ fMinExclusive = new XMLDouble(value);
+}
- }// End of Facet setting
+void DoubleDatatypeValidator::setEnumeration()
+{
+ // check 4.3.5.c0 must: enumeration values from the value space of base
+ //
+ // 1. shall be from base value space
+ // 2. shall be from current value space as well ( shall go through boundsCheck() )
+ //
+ if (!fStrEnumeration)
+ return;
+ int i = 0;
+ int enumLength = fStrEnumeration->size();
- /***
- Schema constraint: Part III -- inherit from base
- ***/
- if ( baseValidator )
- {
- DoubleDatatypeValidator* numBase = (DoubleDatatypeValidator*)baseValidator;
- // inherit enumeration
- if ((( numBase->getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) !=0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) == 0))
- {
- fEnumeration = numBase->getEnumeration();
- fEnumerationInherited = true;
- setFacetsDefined(DatatypeValidator::FACET_ENUMERATION);
- }
+ DoubleDatatypeValidator *numBase = (DoubleDatatypeValidator*) getBaseValidator();
+ if (numBase)
+ {
+ try
+ {
+ for ( i = 0; i < enumLength; i++)
+ {
+ numBase->checkContent(fStrEnumeration->elementAt(i), false);
+ }
+ }
+ catch (XMLException&)
+ {
+ ThrowXML1(InvalidDatatypeFacetException
+ , XMLExcepts::FACET_enum_base
+ , fStrEnumeration->elementAt(i));
- // inherit maxExclusive
- if ((( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) == 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) == 0) )
- {
- setMaxExclusive(new XMLDouble(*(numBase->getMaxExclusive())));
- setFacetsDefined(DatatypeValidator::FACET_MAXEXCLUSIVE);
- }
-
- // inherit maxInclusive
- if ((( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) == 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) == 0) )
- {
- setMaxInclusive(new XMLDouble(*(numBase->getMaxInclusive())));
- setFacetsDefined(DatatypeValidator::FACET_MAXINCLUSIVE);
}
+ }
- // inherit minExclusive
- if ((( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) == 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) == 0) )
- {
- setMinExclusive(new XMLDouble(*(numBase->getMinExclusive())));
- setFacetsDefined(DatatypeValidator::FACET_MINEXCLUSIVE);
- }
-
- // inherit minExclusive
- if ((( numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) == 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) == 0) )
- {
- setMinInclusive(new XMLDouble(*(numBase->getMinInclusive())));
- setFacetsDefined(DatatypeValidator::FACET_MININCLUSIVE);
- }
+ // We put the this->checkContent in a separate loop
+ // to not block original message with in that method.
+ //
+ for ( i = 0; i < enumLength; i++)
+ {
+ checkContent(fStrEnumeration->elementAt(i), false);
+ }
-
- // inherit "fixed" option
- setFixed(getFixed() | numBase->getFixed());
-
- }
+ fEnumeration = new RefVectorOf<XMLNumber>(enumLength, true);
+ fEnumerationInherited = false;
+ for ( i = 0; i < enumLength; i++)
+ {
+ fEnumeration->insertElementAt(new XMLDouble(fStrEnumeration->elementAt(i)), i);
+ }
}
+// -----------------------------------------------------------------------
+// Abstract interface from AbstractNumericValidator
+// -----------------------------------------------------------------------
+
void DoubleDatatypeValidator::checkContent( const XMLCh* const content, bool asBase)
{
- char *p = XMLString::transcode(content);
-
//validate against base validator if any
DoubleDatatypeValidator *pBase = (DoubleDatatypeValidator*) this->getBaseValidator();
- if (pBase !=0)
+ if (pBase)
pBase->checkContent(content, true);
// we check pattern first
@@ -894,13 +271,13 @@
XMLDouble theValue(content);
XMLDouble *theData = &theValue;
- if (getEnumeration() != 0)
+ if (getEnumeration())
{
int i=0;
int enumLength = getEnumeration()->size();
for ( ; i < enumLength; i++)
{
- if (XMLDouble::compareValues(theData, getEnumeration()->elementAt(i))==0)
+ if (compareValues(theData, (XMLDouble*) getEnumeration()->elementAt(i)) ==0 )
break;
}
@@ -908,70 +285,8 @@
ThrowXML1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content);
}
- if ( (getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0 )
- {
- // must be < MaxExclusive
- if (XMLDouble::compareValues(theData, getMaxExclusive()) != -1)
- {
- XMLCh* value1 = theData->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::VALUE_exceed_maxExcl
- , value1
- , value2);
- }
- }
-
- if ( (getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0 )
- {
- // must be <= MaxInclusive
- if (XMLDouble::compareValues(theData, getMaxInclusive()) == 1)
- {
- XMLCh* value1 = theData->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::VALUE_exceed_maxIncl
- , value1
- , value2);
-
- }
- }
-
- if ( (getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0 )
- {
- // must be >= MinInclusive
- if (XMLDouble::compareValues(theData, getMinInclusive()) == -1)
- {
- XMLCh* value1 = theData->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::VALUE_exceed_minIncl
- , value1
- , value2);
- }
- }
+ boundsCheck(theData);
- if ( (getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0 )
- {
- // must be > MinExclusive
- if (XMLDouble::compareValues(theData, getMinExclusive()) != 1)
- {
- XMLCh* value1 = theData->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::VALUE_exceed_minExcl
- , value1
- , value2);
- }
- }
}
catch (XMLException &e)
{
@@ -980,14 +295,6 @@
}
-
-
-// ---------------------------------------------------------------------------
-// Whitespace handling methods
-// ---------------------------------------------------------------------------
-
-
/**
* End of file DoubleDatatypeValidator::cpp
*/
-
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org