00001 
00002 
00003 #if !defined(ERRHEADER_XMLValid)
00004 #define ERRHEADER_XMLValid
00005 
00006 #include <framework/XMLErrorReporter.hpp>
00007 
00008 class XMLValid
00009 {
00010 public :
00011     enum Codes
00012     {
00013         NoError                            = 0
00014       , E_LowBounds                        = 1
00015       , ElementNotDefined                  = 2
00016       , AttNotDefined                      = 3
00017       , NotationNotDeclared                = 4
00018       , RootElemNotLikeDocType             = 5
00019       , RequiredAttrNotProvided            = 6
00020       , ElementNotValidForContent          = 7
00021       , BadIDAttrDefType                   = 8
00022       , InvalidEmptyAttValue               = 9
00023       , ElementAlreadyExists               = 10
00024       , MultipleIdAttrs                    = 11
00025       , ReusedIDValue                      = 12
00026       , IDNotDeclared                      = 13
00027       , UnknownNotRefAttr                  = 14
00028       , UndeclaredElemInDocType            = 15
00029       , EmptyNotValidForContent            = 16
00030       , AttNotDefinedForElement            = 17
00031       , BadEntityRefAttr                   = 18
00032       , UnknownEntityRefAttr               = 19
00033       , NotEnoughElemsForCM                = 20
00034       , NoCharDataInCM                     = 21
00035       , DoesNotMatchEnumList               = 22
00036       , AttrValNotName                     = 23
00037       , NoMultipleValues                   = 24
00038       , NotSameAsFixedValue                = 25
00039       , RepElemInMixed                     = 26
00040       , NoValidatorFor                     = 27
00041       , IncorrectDatatype                  = 28
00042       , NotADatatype                       = 29
00043       , TextOnlyContentWithType            = 30
00044       , FeatureUnsupported                 = 31
00045       , NestedOnlyInElemOnly               = 32
00046       , EltRefOnlyInMixedElemOnly          = 33
00047       , OnlyInEltContent                   = 34
00048       , OrderIsAll                         = 35
00049       , DatatypeWithType                   = 36
00050       , DatatypeQualUnsupported            = 37
00051       , GroupContentRestricted             = 38
00052       , UnknownBaseDatatype                = 39
00053       , OneOfTypeRefArchRef                = 40
00054       , NoContentForRef                    = 41
00055       , IncorrectDefaultType               = 42
00056       , IllegalAttContent                  = 43
00057       , ValueNotInteger                    = 44
00058       , DatatypeError                      = 45
00059       , SchemaError                        = 46
00060       , TypeAlreadySet                     = 47
00061       , ProhibitedAttributePresent         = 48
00062       , IllegalXMLSpace                    = 49
00063       , NotBoolean                         = 50
00064       , NotDecimal                         = 51
00065       , FacetsInconsistent                 = 52
00066       , IllegalFacetValue                  = 53
00067       , IllegalDecimalFacet                = 54
00068       , UnknownFacet                       = 55
00069       , InvalidEnumValue                   = 56
00070       , OutOfBounds                        = 57
00071       , NotAnEnumValue                     = 58
00072       , NotInteger                         = 59
00073       , IllegalIntegerFacet                = 60
00074       , NotReal                            = 61
00075       , IllegalRealFacet                   = 62
00076       , ScaleLargerThanPrecision           = 63
00077       , PrecisionExceeded                  = 64
00078       , ScaleExceeded                      = 65
00079       , NotFloat                           = 66
00080       , SchemaRootError                    = 67
00081       , WrongTargetNamespace               = 68
00082       , SimpleTypeHasChild                 = 69
00083       , NoDatatypeValidatorForSimpleType   = 70
00084       , GrammarNotFound                    = 71
00085       , DisplayErrorMessage                = 72
00086       , NillNotAllowed                     = 73
00087       , NilAttrNotEmpty                    = 74
00088       , FixedDifferentFromActual           = 75
00089       , NoDatatypeValidatorForAttribute    = 76
00090       , GenericError                       = 77
00091       , ElementNotQualified                = 78
00092       , ElementNotUnQualified              = 79
00093       , IllegalRefInStandalone             = 80
00094       , NoDefAttForStandalone              = 81
00095       , NoAttNormForStandalone             = 82
00096       , NoWSForStandalone                  = 83
00097       , VC_EntityNotFound                  = 84
00098       , PartialMarkupInPE                  = 85
00099       , DatatypeValidationFailure          = 86
00100       , UniqueParticleAttributionFail      = 87
00101       , NoAbstractInXsiType                = 88
00102       , NoDirectUseAbstractElement         = 89
00103       , NoUseAbstractType                  = 90
00104       , BadXsiType                         = 91
00105       , NonDerivedXsiType                  = 92
00106       , NoSubforBlock                      = 93
00107       , AttributeNotQualified              = 94
00108       , AttributeNotUnQualified            = 95
00109       , E_HighBounds                       = 96
00110       , W_LowBounds                        = 97
00111       , W_HighBounds                       = 98
00112       , F_LowBounds                        = 99
00113       , F_HighBounds                       = 100
00114     };
00115 
00116     static bool isFatal(const XMLValid::Codes toCheck)
00117     {
00118         return ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds));
00119     }
00120 
00121     static bool isWarning(const XMLValid::Codes toCheck)
00122     {
00123         return ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds));
00124     }
00125 
00126     static bool isError(const XMLValid::Codes toCheck)
00127     {
00128         return ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds));
00129     }
00130 
00131     static XMLErrorReporter::ErrTypes errorType(const XMLValid::Codes toCheck)
00132     {
00133        if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds))
00134            return XMLErrorReporter::ErrType_Warning;
00135        else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds))
00136             return XMLErrorReporter::ErrType_Fatal;
00137        else if ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds))
00138             return XMLErrorReporter::ErrType_Error;
00139        return XMLErrorReporter::ErrTypes_Unknown;
00140     }
00141 };
00142 #endif
00143