00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _SCHEMAVALIDATORH
00022 #define _SCHEMAVALIDATORH
00023
00024 #include <schemaparser/SchemaParser.h>
00025 #include <schemaparser/SchemaParserException.h>
00026 #include <schemaparser/TypeContainer.h>
00027
00028
00029 class SchemaValidator
00030 {
00031 public:
00038 SchemaValidator(const SchemaParser * sp);
00039 ~SchemaValidator();
00040
00042
00054 TypeContainer *validate(XmlPullParser * xpp, int typeId,
00055 TypeContainer * ipTc = 0);
00056
00057 TypeContainer *validate(const std::string & val , int typeId,
00058 TypeContainer * ipTc = 0);
00059 TypeContainer * validate(void* value ,int typeId,
00060 TypeContainer * ipTc=0);
00061
00063 private:
00064
00065 TypeContainer* validateContentModel(XmlPullParser * xpp,
00066 ContentModel* cm,
00067 TypeContainer * ipTc,
00068 const string & elemName,
00069 bool nested=false);
00070
00071 void extractSimpleType(const string & val, int basetype,
00072 TypeContainer * ipTc, const SimpleType * st);
00073 bool validateListOrUnion(const SimpleType* st,
00074 const std::string &val);
00075
00076 bool findElement(ContentModel::ContentsIterator start,
00077 ContentModel::ContentsIterator end,
00078 string name,
00079 ContentModel::ContentsIterator & found);
00080 bool checkAttributeOccurence(const ComplexType* ct ,XmlPullParser* xpp);
00081 void error(const std::string & , XmlPullParser* xpp=0);
00082 const SchemaParser *sParser;
00083
00084 };
00085 #endif