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 , XsiTypeAbstract = 73
00087 , SchemaAbstractError = 74
00088 , NillNotAllowed = 75
00089 , NilAttrNotEmpty = 76
00090 , FixedDifferentFromActual = 77
00091 , NoDatatypeValidatorForAttribute = 78
00092 , GenericError = 79
00093 , ElementNotQualified = 80
00094 , ElementNotUnQualified = 81
00095 , IllegalRefInStandalone = 82
00096 , NoDefAttForStandalone = 83
00097 , NoAttNormForStandalone = 84
00098 , NoWSForStandalone = 85
00099 , VC_EntityNotFound = 86
00100 , PartialMarkupInPE = 87
00101 , E_HighBounds = 88
00102 , W_LowBounds = 89
00103 , W_HighBounds = 90
00104 , F_LowBounds = 91
00105 , F_HighBounds = 92
00106 };
00107
00108 static bool isFatal(const XMLValid::Codes toCheck)
00109 {
00110 return ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds));
00111 }
00112
00113 static bool isWarning(const XMLValid::Codes toCheck)
00114 {
00115 return ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds));
00116 }
00117
00118 static bool isError(const XMLValid::Codes toCheck)
00119 {
00120 return ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds));
00121 }
00122
00123 static XMLErrorReporter::ErrTypes errorType(const XMLValid::Codes toCheck)
00124 {
00125 if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds))
00126 return XMLErrorReporter::ErrType_Warning;
00127 else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds))
00128 return XMLErrorReporter::ErrType_Fatal;
00129 else if ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds))
00130 return XMLErrorReporter::ErrType_Error;
00131 return XMLErrorReporter::ErrTypes_Unknown;
00132 }
00133 };
00134 #endif
00135