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 , V_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 , V_HighBounds = 27
00041 , W_LowBounds = 28
00042 , W_HighBounds = 29
00043 , E_LowBounds = 30
00044 , E_HighBounds = 31
00045 };
00046
00047 static bool isFatal(const XMLValid::Codes toCheck)
00048 {
00049 return ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds));
00050 }
00051
00052 static bool isWarning(const XMLValid::Codes toCheck)
00053 {
00054 return ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds));
00055 }
00056
00057 static bool isValid(const XMLValid::Codes toCheck)
00058 {
00059 return ((toCheck >= V_LowBounds) && (toCheck <= V_HighBounds));
00060 }
00061
00062 static XMLErrorReporter::ErrTypes errorType(const XMLValid::Codes toCheck)
00063 {
00064 if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds))
00065 return XMLErrorReporter::ErrType_Warning;
00066 else if ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds))
00067 return XMLErrorReporter::ErrType_Fatal;
00068 else if ((toCheck >= V_LowBounds) && (toCheck <= V_HighBounds))
00069 return XMLErrorReporter::ErrType_Invalid;
00070 return XMLErrorReporter::ErrTypes_Unknown;
00071 }
00072 };
00073 #endif
00074