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 #ifndef WSDLPULL_EXPORT
00029 #if (defined _MSC_VER) && (defined _MT)
00030 #define WSDLPULL_EXPORT __declspec (dllimport)
00031 #else
00032 #define WSDLPULL_EXPORT
00033 #endif
00034 #endif
00035
00036 namespace Schema {
00037
00038
00039 class WSDLPULL_EXPORT SchemaValidator
00040 {
00041 public:
00048 SchemaValidator(const SchemaParser * sp);
00049 ~SchemaValidator();
00050
00052
00064 TypeContainer *validate(XmlPullParser * xpp, int typeId,
00065 TypeContainer * ipTc = 0);
00066
00067 TypeContainer *validate(const std::string & val , int typeId,
00068 TypeContainer * ipTc = 0, XmlPullParser * xpp = 0);
00069 TypeContainer * validate(void* value ,int typeId,
00070 TypeContainer * ipTc = 0, XmlPullParser * xpp = 0);
00071
00073 private:
00074
00075 TypeContainer* validateContentModel(XmlPullParser * xpp,
00076 ContentModel* cm,
00077 TypeContainer * ipTc,
00078 const std::string & elemName,
00079 bool nested=false);
00080
00081 void extractSimpleType(const std::string & val, int basetype,
00082 TypeContainer * ipTc, const SimpleType * st,
00083 XmlPullParser * xpp);
00084 bool validateListOrUnion(const SimpleType* st,
00085 const std::string &val, XmlPullParser * xpp);
00086
00087 bool findElement(ContentModel::ContentsIterator start,
00088 ContentModel::ContentsIterator end,
00089 std::string name,
00090 ContentModel::ContentsIterator & found);
00091 bool checkAttributeOccurence(const ComplexType* ct ,XmlPullParser* xpp);
00092 void error(const std::string & , XmlPullParser* xpp=0);
00093 const SchemaParser *sParser;
00094
00095 };
00096 }
00097 #endif