You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/05/18 15:36:59 UTC
cvs commit: xml-xerces/c/src/validators/datatype Base64BinaryDatatypeValidator.cpp BooleanDatatypeValidator.cpp DecimalDatatypeValidator.cpp HexBinaryDatatypeValidator.cpp StringDatatypeValidator.cpp
tng 01/05/18 06:36:58
Modified: c/src/validators/datatype Base64BinaryDatatypeValidator.cpp
BooleanDatatypeValidator.cpp
DecimalDatatypeValidator.cpp
HexBinaryDatatypeValidator.cpp
StringDatatypeValidator.cpp
Log:
Schema: Catch RegularExpression exception and NumberFormatException
Revision Changes Path
1.4 +14 -4 xml-xerces/c/src/validators/datatype/Base64BinaryDatatypeValidator.cpp
Index: Base64BinaryDatatypeValidator.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/datatype/Base64BinaryDatatypeValidator.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Base64BinaryDatatypeValidator.cpp 2001/05/18 13:23:43 1.3
+++ Base64BinaryDatatypeValidator.cpp 2001/05/18 13:36:41 1.4
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,7 +48,7 @@
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
- * originally based on software copyright (c) 1999, International
+ * originally based on software copyright (c) 2001, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
@@ -56,6 +56,9 @@
/*
* $Log: Base64BinaryDatatypeValidator.cpp,v $
+ * Revision 1.4 2001/05/18 13:36:41 tng
+ * Schema: Catch RegularExpression exception and NumberFormatException
+ *
* Revision 1.3 2001/05/18 13:23:43 tng
* Schema: Exception messages in DatatypeValidator. By Pei Yong Zhang.
*
@@ -460,8 +463,15 @@
if ( (getFacetsDefined() & DatatypeValidator::FACET_PATTERN ) != 0 )
{
// lazy construction
- if (getRegex() ==0)
- setRegex(new RegularExpression(getPattern(), SchemaSymbols::fgRegEx_XOption));
+ if (getRegex() ==0) {
+ try {
+ setRegex(new RegularExpression(getPattern(), SchemaSymbols::fgRegEx_XOption));
+ }
+ catch (XMLException &e)
+ {
+ ThrowXML1(InvalidDatatypeValueException, XMLExcepts::RethrowError, e.getMessage());
+ }
+ }
if (getRegex()->matches(content) ==false)
{
1.3 +12 -2 xml-xerces/c/src/validators/datatype/BooleanDatatypeValidator.cpp
Index: BooleanDatatypeValidator.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/datatype/BooleanDatatypeValidator.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BooleanDatatypeValidator.cpp 2001/05/11 13:27:26 1.2
+++ BooleanDatatypeValidator.cpp 2001/05/18 13:36:44 1.3
@@ -56,6 +56,9 @@
/*
* $Log: BooleanDatatypeValidator.cpp,v $
+ * Revision 1.3 2001/05/18 13:36:44 tng
+ * Schema: Catch RegularExpression exception and NumberFormatException
+ *
* Revision 1.2 2001/05/11 13:27:26 tng
* Copyright update.
*
@@ -130,8 +133,15 @@
if ( (getFacetsDefined() & DatatypeValidator::FACET_PATTERN ) != 0 )
{
// lazy construction
- if (getRegex() ==0)
- setRegex(new RegularExpression(getPattern(), SchemaSymbols::fgRegEx_XOption));
+ if (getRegex() ==0) {
+ try {
+ setRegex(new RegularExpression(getPattern(), SchemaSymbols::fgRegEx_XOption));
+ }
+ catch (XMLException &e)
+ {
+ ThrowXML1(InvalidDatatypeValueException, XMLExcepts::RethrowError, e.getMessage());
+ }
+ }
if (getRegex()->matches(content) ==false)
{
1.5 +615 -592 xml-xerces/c/src/validators/datatype/DecimalDatatypeValidator.cpp
Index: DecimalDatatypeValidator.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/datatype/DecimalDatatypeValidator.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DecimalDatatypeValidator.cpp 2001/05/18 13:23:46 1.4
+++ DecimalDatatypeValidator.cpp 2001/05/18 13:36:45 1.5
@@ -56,6 +56,9 @@
/*
* $Log: DecimalDatatypeValidator.cpp,v $
+ * Revision 1.5 2001/05/18 13:36:45 tng
+ * Schema: Catch RegularExpression exception and NumberFormatException
+ *
* Revision 1.4 2001/05/18 13:23:46 tng
* Schema: Exception messages in DatatypeValidator. By Pei Yong Zhang.
*
@@ -241,585 +244,592 @@
/***
Schema constraint: Part I -- self checking
***/
-
- 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);
+ try {
- //
- // minExclusive < minInclusive <= maxInclusive < maxExclusive
- //
- // check 4.3.7.c1 must: minInclusive <= maxInclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) )
- {
- if ( XMLBigDecimal::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 ( XMLBigDecimal::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 ( XMLBigDecimal::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 ( XMLBigDecimal::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);
- }
- }
-
- // check 4.3.12.c1 must: fractionDigits <= totalDigits
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_SCALE) != 0) &&
- ((getFacetsDefined() & DatatypeValidator::FACET_PRECISSION) != 0) )
- {
- if ( fFractionDigits > fTotalDigits )
- {
- XMLString::binToText(getFractionDigits(), value1, BUF_LEN, 10);
- XMLString::binToText(getTotalDigits(), value2, BUF_LEN, 10);
-
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_TotDigit_FractDigit
- , value2
- , value1);
- }
- }
-
- } // if getFacetsDefined
-
- /***
- Schema constraint: Part II -- self vs base
- ***/
-
- if ( baseValidator != 0 )
- {
- DecimalDatatypeValidator* numBase = (DecimalDatatypeValidator*)baseValidator;
-
- // 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
+ // 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);
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) )
+ //
+ // minExclusive < minInclusive <= maxInclusive < maxExclusive
+ //
+ // check 4.3.7.c1 must: minInclusive <= maxInclusive
+ if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
+ ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) )
{
- if ( ((numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ( XMLBigDecimal::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) &&
- ( XMLBigDecimal::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) &&
- ( XMLBigDecimal::compareValues(getMaxInclusive(), numBase->getMinInclusive()) == -1 ))
+ if ( XMLBigDecimal::compareValues(getMinInclusive(), getMaxInclusive()) == 1 )
{
- XMLCh* value1 = getMaxInclusive()->toString();
+ XMLCh* value1 = getMinInclusive()->toString();
ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinInclusive()->toString();
+ XMLCh* value2 = getMaxInclusive()->toString();
ArrayJanitor<XMLCh> jan2(value2);
ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_base_minIncl
- , value1
- , value2);
+ , XMLExcepts::FACET_maxIncl_minIncl
+ , value2
+ , value1);
}
+ }
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- ( XMLBigDecimal::compareValues(getMaxInclusive(), numBase->getMinExclusive() ) != 1 ))
+ // check 4.3.8.c2 must: minExclusive <= maxExclusive ??? minExclusive < maxExclusive
+ if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
+ ((getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) )
+ {
+ if ( XMLBigDecimal::compareValues(getMinExclusive(), getMaxExclusive()) == 1 )
{
- XMLCh* value1 = getMaxInclusive()->toString();
+ XMLCh* value1 = getMinExclusive()->toString();
ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMinExclusive()->toString();
+ XMLCh* value2 = getMaxExclusive()->toString();
ArrayJanitor<XMLCh> jan2(value2);
ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_base_minExcl
- , value1
- , value2);
+ , XMLExcepts::FACET_maxExcl_minExcl
+ , value2
+ , value1);
}
}
- // check 4.3.8.c3 error:
- // maxExclusive > base.maxExclusive
- // maxExclusive > base.maxInclusive
- // maxExclusive <= base.minInclusive
- // maxExclusive <= base.minExclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) )
+ // check 4.3.9.c2 must: minExclusive < maxInclusive
+ if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
+ ((getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) )
{
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- ( XMLBigDecimal::compareValues(getMaxExclusive(), numBase->getMaxExclusive()) == 1 ))
+ if ( XMLBigDecimal::compareValues(getMinExclusive(), getMaxInclusive()) != -1 )
{
- XMLCh* value1 = getMaxExclusive()->toString();
+ XMLCh* value1 = getMinExclusive()->toString();
ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxExclusive()->toString();
+ XMLCh* value2 = getMaxInclusive()->toString();
ArrayJanitor<XMLCh> jan2(value2);
ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_base_maxExcl
- , value1
- , value2);
+ , XMLExcepts::FACET_maxIncl_minExcl
+ , value2
+ , value1);
}
+ }
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
- ( XMLBigDecimal::compareValues(getMaxExclusive(), numBase->getMaxInclusive()) == 1 ))
+ // check 4.3.10.c1 must: minInclusive < maxExclusive
+ if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
+ ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) )
+ {
+ if ( XMLBigDecimal::compareValues(getMinInclusive(), getMaxExclusive()) != -1 )
{
- XMLCh* value1 = getMaxExclusive()->toString();
+ XMLCh* value1 = getMinInclusive()->toString();
ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = numBase->getMaxInclusive()->toString();
+ XMLCh* value2 = getMaxExclusive()->toString();
ArrayJanitor<XMLCh> jan2(value2);
ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_base_maxIncl
- , value1
- , value2);
+ , XMLExcepts::FACET_maxExcl_minIncl
+ , value2
+ , value1);
}
+ }
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- ( XMLBigDecimal::compareValues(getMaxExclusive(), numBase->getMinExclusive() ) != 1 ))
+ // check 4.3.12.c1 must: fractionDigits <= totalDigits
+ if ( ((getFacetsDefined() & DatatypeValidator::FACET_SCALE) != 0) &&
+ ((getFacetsDefined() & DatatypeValidator::FACET_PRECISSION) != 0) )
+ {
+ if ( fFractionDigits > fTotalDigits )
{
- 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);
- }
+ XMLString::binToText(getFractionDigits(), value1, BUF_LEN, 10);
+ XMLString::binToText(getTotalDigits(), value2, BUF_LEN, 10);
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- ( XMLBigDecimal::compareValues(getMaxExclusive(), numBase->getMinInclusive()) != 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);
+ ThrowXML2(InvalidDatatypeFacetException
+ , XMLExcepts::FACET_TotDigit_FractDigit
+ , value2
+ , value1);
}
}
+
+ } // if getFacetsDefined
- // check 4.3.9.c3 error:
- // minExclusive < base.minExclusive
- // minExclusive > base.maxInclusive ??? minExclusive >= base.maxInclusive
- // minExclusive < base.minInclusive
- // minExclusive >= base.maxExclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) )
+ /***
+ Schema constraint: Part II -- self vs base
+ ***/
+
+ if ( baseValidator != 0 )
+ {
+ DecimalDatatypeValidator* numBase = (DecimalDatatypeValidator*)baseValidator;
+
+ // this
+ // minExclusive maxExclusive
+ // minInclusive maxInclusive
+ //
+ // base
+ // minExclusive maxExclusive
+ // minInclusive maxExclusive
+ //
+ if ( getFacetsDefined() != 0 )
{
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
- ( XMLBigDecimal::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);
- }
+ // check 4.3.7.c2 error:
+ // maxInclusive > base.maxInclusive
+ // maxInclusive >= base.maxExclusive
+ // maxInclusive < base.minInclusive
+ // maxInclusive <= base.minExclusive
+
+ if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) )
+ {
+ if ( ((numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
+ ( XMLBigDecimal::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_MAXINCLUSIVE) != 0) &&
- ( XMLBigDecimal::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_MAXEXCLUSIVE) != 0) &&
+ ( XMLBigDecimal::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) &&
- ( XMLBigDecimal::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_MININCLUSIVE) != 0) &&
+ ( XMLBigDecimal::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_MAXEXCLUSIVE) != 0) &&
- ( XMLBigDecimal::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) &&
+ ( XMLBigDecimal::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);
+ }
}
- }
- // check 4.3.10.c2 error:
- // minInclusive < base.minInclusive
- // minInclusive > base.maxInclusive
- // minInclusive <= base.minExclusive
- // minInclusive >= base.maxExclusive
- if ( ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) )
- {
- if ( ((numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
- ( XMLBigDecimal::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);
- }
+ // check 4.3.8.c3 error:
+ // maxExclusive > base.maxExclusive
+ // maxExclusive > base.maxInclusive
+ // maxExclusive <= base.minInclusive
+ // maxExclusive <= base.minExclusive
+ if ( ((getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) )
+ {
+ if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
+ ( XMLBigDecimal::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) &&
- ( XMLBigDecimal::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_MAXINCLUSIVE) != 0) &&
+ ( XMLBigDecimal::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) &&
- ( XMLBigDecimal::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_MINEXCLUSIVE) != 0) &&
+ ( XMLBigDecimal::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_MAXEXCLUSIVE) != 0) &&
- ( XMLBigDecimal::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) &&
+ ( XMLBigDecimal::compareValues(getMaxExclusive(), numBase->getMinInclusive()) != 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);
+ }
}
- }
+ // check 4.3.9.c3 error:
+ // minExclusive < base.minExclusive
+ // minExclusive > base.maxInclusive ??? minExclusive >= base.maxInclusive
+ // minExclusive < base.minInclusive
+ // minExclusive >= base.maxExclusive
+ if ( ((getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) )
+ {
+ if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
+ ( XMLBigDecimal::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);
+ }
- // check 4.3.11.c1 error: totalDigits > base.totalDigits
- if (( getFacetsDefined() & DatatypeValidator::FACET_PRECISSION) != 0)
- {
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_PRECISSION) != 0) &&
- ( fTotalDigits > numBase->fTotalDigits ))
- {
- XMLString::binToText(fTotalDigits, value1, BUF_LEN, 10);
- XMLString::binToText(numBase->fTotalDigits, value2, BUF_LEN, 10);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::FACET_TotDigit_FractDigit
- , value2
- , value1);
- }
- }
+ if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
+ ( XMLBigDecimal::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);
+ }
- // check question error: fractionDigits > base.fractionDigits ???
- // check question error: fractionDigits > base.totalDigits ???
- // check question error: totalDigits conflicts with bounds ???
+ if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
+ ( XMLBigDecimal::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);
+ }
- // 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 = 0;
- int enumLength = fStrEnumeration->size();
- try
- {
- for ( ; i < enumLength; i++)
- // ask parent do a complete check
- numBase->checkContent(fStrEnumeration->elementAt(i), false);
+ if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
+ ( XMLBigDecimal::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);
+ }
}
- catch ( XMLException& )
- {
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_enum_base
- , fStrEnumeration->elementAt(i));
- }
+ // check 4.3.10.c2 error:
+ // minInclusive < base.minInclusive
+ // minInclusive > base.maxInclusive
+ // minInclusive <= base.minExclusive
+ // minInclusive >= base.maxExclusive
+ if ( ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) )
+ {
+ if ( ((numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
+ ( XMLBigDecimal::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);
+ }
- //
- // we need to convert from fStrEnumeration to fEnumeration
- try
- {
- setEnumeration( new RefVectorOf<XMLBigDecimal>(enumLength, true));
- for ( i = 0; i < enumLength; i++)
- getEnumeration()->insertElementAt(new XMLBigDecimal(fStrEnumeration->elementAt(i)), i);
+ if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
+ ( XMLBigDecimal::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) &&
+ ( XMLBigDecimal::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) &&
+ ( XMLBigDecimal::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);
+ }
+
}
- catch ( NumberFormatException& )
+
+ // check 4.3.11.c1 error: totalDigits > base.totalDigits
+ if (( getFacetsDefined() & DatatypeValidator::FACET_PRECISSION) != 0)
{
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_enum_base
- , fStrEnumeration->elementAt(i));
+ if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_PRECISSION) != 0) &&
+ ( fTotalDigits > numBase->fTotalDigits ))
+ {
+ XMLString::binToText(fTotalDigits, value1, BUF_LEN, 10);
+ XMLString::binToText(numBase->fTotalDigits, value2, BUF_LEN, 10);
+ ThrowXML2(InvalidDatatypeFacetException
+ , XMLExcepts::FACET_TotDigit_FractDigit
+ , value2
+ , value1);
+ }
}
- }
+ // check question error: fractionDigits > base.fractionDigits ???
+ // check question error: fractionDigits > base.totalDigits ???
+ // check question error: totalDigits conflicts with bounds ???
- //
- // maxInclusive
- // maxExclusive
- // minInclusive
- // minExclusive
- // shall come from the base's value space as well
- //
- if ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0)
- {
- try
+ // 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 ))
{
- // ask parent do a complete check
- numBase->checkContent(getMaxInclusive()->toString(), false);
+ int i = 0;
+ int enumLength = fStrEnumeration->size();
+ try
+ {
+ for ( ; i < enumLength; i++)
+ // ask parent do a complete check
+ numBase->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
+ {
+ setEnumeration( new RefVectorOf<XMLBigDecimal>(enumLength, true));
+ for ( i = 0; i < enumLength; i++)
+ getEnumeration()->insertElementAt(new XMLBigDecimal(fStrEnumeration->elementAt(i)), i);
+
+ }
+ catch ( NumberFormatException& )
+ {
+ ThrowXML1(InvalidDatatypeFacetException
+ , XMLExcepts::FACET_enum_base
+ , fStrEnumeration->elementAt(i));
+ }
+
}
- catch ( XMLException& )
+
+ //
+ // maxInclusive
+ // maxExclusive
+ // minInclusive
+ // minExclusive
+ // shall come from the base's value space as well
+ //
+ if ((getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0)
{
- XMLCh* value1 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan(value1);
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxIncl_notFromBase
- , value1
- );
+ 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
+ );
+ }
+ }
+
+ }
+
+ /***
+ Schema constraint: Part III -- inherit from base
+ ***/
+
+ // inherit enumeration
+ if ((( numBase->getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) !=0) &&
+ (( getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) == 0))
+ {
+ setFacetsDefined(DatatypeValidator::FACET_ENUMERATION);
+ // need to adopt the Vector
+ RefVectorOf<XMLBigDecimal>* fBaseEnumeration = numBase->getEnumeration();
+ int enumLength = fBaseEnumeration->size();
+ setEnumeration(new RefVectorOf<XMLBigDecimal>(enumLength, true));
+ for ( int i = 0; i < enumLength; i++)
+ //invoke XMLBigDecimal's copy ctor
+ getEnumeration()->insertElementAt(new XMLBigDecimal(*(fBaseEnumeration->elementAt(i))), i);
+
}
- }
- if ((getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0)
- {
- try
+ // inherit maxExclusive
+ if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
+ (( getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) == 0) &&
+ (( getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) == 0) )
{
- // ask parent do a complete check
- numBase->checkContent(getMaxExclusive()->toString(), false);
+ setMaxExclusive(new XMLBigDecimal(*(numBase->getMaxExclusive())));
+ setFacetsDefined(DatatypeValidator::FACET_MAXEXCLUSIVE);
}
- catch ( XMLException& )
+
+ // inherit maxInclusive
+ if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0) &&
+ (( getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) == 0) &&
+ (( getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) == 0) )
{
- XMLCh* value1 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan(value1);
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_maxExcl_notFromBase
- , value1
- );
+ setMaxInclusive(new XMLBigDecimal(*(numBase->getMaxInclusive())));
+ setFacetsDefined(DatatypeValidator::FACET_MAXINCLUSIVE);
}
- }
- if ((getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0)
- {
- try
+ // inherit minExclusive
+ if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0) &&
+ (( getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) == 0) &&
+ (( getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) == 0) )
{
- // ask parent do a complete check
- numBase->checkContent(getMinInclusive()->toString(), false);
+ setMinExclusive(new XMLBigDecimal(*(numBase->getMinExclusive())));
+ setFacetsDefined(DatatypeValidator::FACET_MINEXCLUSIVE);
}
- catch ( XMLException& )
+
+ // inherit minExclusive
+ if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0) &&
+ (( getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) == 0) &&
+ (( getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) == 0) )
{
- XMLCh* value1 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan(value1);
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minIncl_notFromBase
- , value1
- );
+ setMinInclusive(new XMLBigDecimal(*(numBase->getMinInclusive())));
+ setFacetsDefined(DatatypeValidator::FACET_MININCLUSIVE);
}
- }
-
- if ((getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0)
- {
- try
+
+ // inherit totalDigits
+ if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_PRECISSION) != 0) &&
+ (( getFacetsDefined() & DatatypeValidator::FACET_PRECISSION) == 0) )
{
- // ask parent do a complete check
- numBase->checkContent(getMinExclusive()->toString(), false);
+ setTotalDigits(numBase->fTotalDigits);
+ setFacetsDefined(DatatypeValidator::FACET_PRECISSION);
}
- catch ( XMLException& )
+
+ // inherit fractionDigits
+ if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_SCALE) != 0) &&
+ (( getFacetsDefined() & DatatypeValidator::FACET_SCALE) == 0) )
{
- XMLCh* value1 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan(value1);
- ThrowXML1(InvalidDatatypeFacetException
- , XMLExcepts::FACET_minExcl_notFromBase
- , value1
- );
+ setFractionDigits(numBase->fFractionDigits);
+ setFacetsDefined(DatatypeValidator::FACET_SCALE);
}
- }
-
- }
- /***
- Schema constraint: Part III -- inherit from base
- ***/
-
- // inherit enumeration
- if ((( numBase->getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) !=0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_ENUMERATION) == 0))
- {
- setFacetsDefined(DatatypeValidator::FACET_ENUMERATION);
- // need to adopt the Vector
- RefVectorOf<XMLBigDecimal>* fBaseEnumeration = numBase->getEnumeration();
- int enumLength = fBaseEnumeration->size();
- setEnumeration(new RefVectorOf<XMLBigDecimal>(enumLength, true));
- for ( int i = 0; i < enumLength; i++)
- //invoke XMLBigDecimal's copy ctor
- getEnumeration()->insertElementAt(new XMLBigDecimal(*(fBaseEnumeration->elementAt(i))), i);
-
- }
-
- // inherit maxExclusive
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) == 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) == 0) )
- {
- setMaxExclusive(new XMLBigDecimal(*(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 XMLBigDecimal(*(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 XMLBigDecimal(*(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 XMLBigDecimal(*(numBase->getMinInclusive())));
- setFacetsDefined(DatatypeValidator::FACET_MININCLUSIVE);
- }
-
- // inherit totalDigits
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_PRECISSION) != 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_PRECISSION) == 0) )
- {
- setTotalDigits(numBase->fTotalDigits);
- setFacetsDefined(DatatypeValidator::FACET_PRECISSION);
- }
-
- // inherit fractionDigits
- if ( (( numBase->getFacetsDefined() & DatatypeValidator::FACET_SCALE) != 0) &&
- (( getFacetsDefined() & DatatypeValidator::FACET_SCALE) == 0) )
- {
- setFractionDigits(numBase->fFractionDigits);
- setFacetsDefined(DatatypeValidator::FACET_SCALE);
- }
-
- } //if baseValidator
+ } //if baseValidator
+ }
+ catch (XMLException &e)
+ {
+ ThrowXML1(InvalidDatatypeFacetException, XMLExcepts::RethrowError, e.getMessage());
+ }
}// End of Facet setting
@@ -837,8 +847,15 @@
if ( (getFacetsDefined() & DatatypeValidator::FACET_PATTERN ) != 0 )
{
// lazy construction
- if (getRegex() ==0)
- setRegex(new RegularExpression(getPattern(), SchemaSymbols::fgRegEx_XOption));
+ if (getRegex() ==0) {
+ try {
+ setRegex(new RegularExpression(getPattern(), SchemaSymbols::fgRegEx_XOption));
+ }
+ catch (XMLException &e)
+ {
+ ThrowXML1(InvalidDatatypeValueException, XMLExcepts::RethrowError, e.getMessage());
+ }
+ }
if (getRegex()->matches(content) ==false)
{
@@ -854,118 +871,124 @@
if (asBase)
return;
- XMLBigDecimal theValue(content);
- XMLBigDecimal *theData = &theValue;
+ try {
+ XMLBigDecimal theValue(content);
+ XMLBigDecimal *theData = &theValue;
- if (getEnumeration() != 0)
- {
- int i=0;
- int enumLength = getEnumeration()->size();
- for ( ; i < enumLength; i++)
+ if (getEnumeration() != 0)
{
- if (XMLBigDecimal::compareValues(theData, getEnumeration()->elementAt(i))==0)
- break;
- }
+ int i=0;
+ int enumLength = getEnumeration()->size();
+ for ( ; i < enumLength; i++)
+ {
+ if (XMLBigDecimal::compareValues(theData, getEnumeration()->elementAt(i))==0)
+ break;
+ }
- if (i == enumLength)
- ThrowXML1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content);
- }
+ if (i == enumLength)
+ ThrowXML1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content);
+ }
- if ( (getFacetsDefined() & DatatypeValidator::FACET_SCALE) != 0 )
- {
- if ( theData->getScale() > fFractionDigits )
+ if ( (getFacetsDefined() & DatatypeValidator::FACET_SCALE) != 0 )
{
- XMLCh* value = theData->toString();
- XMLString::binToText(theData->getScale(), value1, BUF_LEN, 10);
- XMLString::binToText(fFractionDigits, value2, BUF_LEN, 10);
- ThrowXML3(InvalidDatatypeFacetException
- , XMLExcepts::VALUE_exceed_fractDigit
- , value
- , value1
- , value2);
- }
- }
+ if ( theData->getScale() > fFractionDigits )
+ {
+ XMLCh* value = theData->toString();
+ XMLString::binToText(theData->getScale(), value1, BUF_LEN, 10);
+ XMLString::binToText(fFractionDigits, value2, BUF_LEN, 10);
+ ThrowXML3(InvalidDatatypeFacetException
+ , XMLExcepts::VALUE_exceed_fractDigit
+ , value
+ , value1
+ , value2);
+ }
+ }
- if ( (getFacetsDefined() & DatatypeValidator::FACET_PRECISSION) != 0 )
- {
- if ( theData->getTotalDigit() > fTotalDigits )
+ if ( (getFacetsDefined() & DatatypeValidator::FACET_PRECISSION) != 0 )
{
- XMLCh* value = theData->toString();
- ArrayJanitor<XMLCh> jan(value);
- XMLString::binToText(theData->getTotalDigit(), value1, BUF_LEN, 10);
- XMLString::binToText(fTotalDigits, value2, BUF_LEN, 10);
- ThrowXML3(InvalidDatatypeFacetException
- , XMLExcepts::VALUE_exceed_totalDigit
- , value
- , value1
- , value2);
+ if ( theData->getTotalDigit() > fTotalDigits )
+ {
+ XMLCh* value = theData->toString();
+ ArrayJanitor<XMLCh> jan(value);
+ XMLString::binToText(theData->getTotalDigit(), value1, BUF_LEN, 10);
+ XMLString::binToText(fTotalDigits, value2, BUF_LEN, 10);
+ ThrowXML3(InvalidDatatypeFacetException
+ , XMLExcepts::VALUE_exceed_totalDigit
+ , value
+ , value1
+ , value2);
+ }
}
- }
- if ( (getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0 )
- {
- // must be < MaxExclusive
- if (XMLBigDecimal::compareValues(theData, getMaxExclusive()) != -1)
+ if ( (getFacetsDefined() & DatatypeValidator::FACET_MAXEXCLUSIVE) != 0 )
{
- XMLCh* value1 = theData->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMaxExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::VALUE_exceed_maxExcl
- , value1
- , value2);
+ // must be < MaxExclusive
+ if (XMLBigDecimal::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 (XMLBigDecimal::compareValues(theData, getMaxInclusive()) == 1)
+ if ( (getFacetsDefined() & DatatypeValidator::FACET_MAXINCLUSIVE) != 0 )
{
- XMLCh* value1 = theData->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMaxInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::VALUE_exceed_maxIncl
- , value1
- , value2);
+ // must be <= MaxInclusive
+ if (XMLBigDecimal::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 (XMLBigDecimal::compareValues(theData, getMinInclusive()) == -1)
+ if ( (getFacetsDefined() & DatatypeValidator::FACET_MININCLUSIVE) != 0 )
{
- XMLCh* value1 = theData->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMinInclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::VALUE_exceed_minIncl
- , value1
- , value2);
+ // must be >= MinInclusive
+ if (XMLBigDecimal::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 (XMLBigDecimal::compareValues(theData, getMinExclusive()) != 1)
+ if ( (getFacetsDefined() & DatatypeValidator::FACET_MINEXCLUSIVE) != 0 )
{
- XMLCh* value1 = theData->toString();
- ArrayJanitor<XMLCh> jan1(value1);
- XMLCh* value2 = getMinExclusive()->toString();
- ArrayJanitor<XMLCh> jan2(value2);
- ThrowXML2(InvalidDatatypeFacetException
- , XMLExcepts::VALUE_exceed_minExcl
- , value1
- , value2);
+ // must be > MinExclusive
+ if (XMLBigDecimal::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)
+ {
+ ThrowXML1(InvalidDatatypeFacetException, XMLExcepts::RethrowError, e.getMessage());
}
}
1.4 +12 -2 xml-xerces/c/src/validators/datatype/HexBinaryDatatypeValidator.cpp
Index: HexBinaryDatatypeValidator.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/datatype/HexBinaryDatatypeValidator.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HexBinaryDatatypeValidator.cpp 2001/05/18 13:23:49 1.3
+++ HexBinaryDatatypeValidator.cpp 2001/05/18 13:36:47 1.4
@@ -56,6 +56,9 @@
/*
* $Log: HexBinaryDatatypeValidator.cpp,v $
+ * Revision 1.4 2001/05/18 13:36:47 tng
+ * Schema: Catch RegularExpression exception and NumberFormatException
+ *
* Revision 1.3 2001/05/18 13:23:49 tng
* Schema: Exception messages in DatatypeValidator. By Pei Yong Zhang.
*
@@ -459,8 +462,15 @@
if ( (getFacetsDefined() & DatatypeValidator::FACET_PATTERN ) != 0 )
{
// lazy construction
- if (getRegex() ==0)
- setRegex(new RegularExpression(getPattern(), SchemaSymbols::fgRegEx_XOption));
+ if (getRegex() ==0) {
+ try {
+ setRegex(new RegularExpression(getPattern(), SchemaSymbols::fgRegEx_XOption));
+ }
+ catch (XMLException &e)
+ {
+ ThrowXML1(InvalidDatatypeValueException, XMLExcepts::RethrowError, e.getMessage());
+ }
+ }
if (getRegex()->matches(content) ==false)
{
1.6 +12 -2 xml-xerces/c/src/validators/datatype/StringDatatypeValidator.cpp
Index: StringDatatypeValidator.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/datatype/StringDatatypeValidator.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- StringDatatypeValidator.cpp 2001/05/18 13:23:51 1.5
+++ StringDatatypeValidator.cpp 2001/05/18 13:36:48 1.6
@@ -56,6 +56,9 @@
/*
* $Log: StringDatatypeValidator.cpp,v $
+ * Revision 1.6 2001/05/18 13:36:48 tng
+ * Schema: Catch RegularExpression exception and NumberFormatException
+ *
* Revision 1.5 2001/05/18 13:23:51 tng
* Schema: Exception messages in DatatypeValidator. By Pei Yong Zhang.
*
@@ -501,8 +504,15 @@
if ( (getFacetsDefined() & DatatypeValidator::FACET_PATTERN ) != 0 )
{
// lazy construction
- if (getRegex() ==0)
- setRegex(new RegularExpression(getPattern(), SchemaSymbols::fgRegEx_XOption));
+ if (getRegex() ==0) {
+ try {
+ setRegex(new RegularExpression(getPattern(), SchemaSymbols::fgRegEx_XOption));
+ }
+ catch (XMLException &e)
+ {
+ ThrowXML1(InvalidDatatypeValueException, XMLExcepts::RethrowError, e.getMessage());
+ }
+ }
if (getRegex()->matches(content) ==false)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org