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 "xmlpull/wsdlpull_export.h"
00025 #include "schemaparser/SchemaParser.h"
00026 #include "schemaparser/SchemaParserException.h"
00027 #include "schemaparser/TypeContainer.h"
00028
00029
00030 namespace Schema {
00031
00032
00033 class WSDLPULL_EXPORT SchemaValidator
00034 {
00035 public:
00042 SchemaValidator(const SchemaParser * sp);
00043 ~SchemaValidator();
00044
00046
00058 TypeContainer *validate(XmlPullParser * xpp, int typeId,
00059 TypeContainer * ipTc = 0);
00060
00061 TypeContainer *validate(const std::string & val , int typeId,
00062 TypeContainer * ipTc = 0, XmlPullParser * xpp = 0);
00063 TypeContainer * validate(void* value ,int typeId,
00064 TypeContainer * ipTc = 0, XmlPullParser * xpp = 0);
00065
00067 private:
00068
00069 TypeContainer* validateContentModel(XmlPullParser * xpp,
00070 ContentModel* cm,
00071 TypeContainer * ipTc,
00072 const std::string & elemName,
00073 bool nested=false);
00074
00075 void extractSimpleType(const std::string & val, int basetype,
00076 TypeContainer * ipTc, const SimpleType * st,
00077 XmlPullParser * xpp);
00078 bool validateListOrUnion(const SimpleType* st,
00079 const std::string &val, XmlPullParser * xpp);
00080
00081 bool findElement(ContentModel::ContentsIterator start,
00082 ContentModel::ContentsIterator end,
00083 std::string name,
00084 ContentModel::ContentsIterator & found);
00085 bool checkAttributeOccurence(const ComplexType* ct ,XmlPullParser* xpp);
00086 void error(const std::string & , XmlPullParser* xpp=0);
00087 const SchemaParser *sParser;
00088
00089 };
00090 }
00091 #endif