wsdlpull  1.23
SchemaValidator.h
Go to the documentation of this file.
1 /*
2  * wsdlpull - A C++ parser for WSDL (Web services description language)
3  * Copyright (C) 2005-2007 Vivek Krishna
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  *
20  */
21 #ifndef _SCHEMAVALIDATORH
22 #define _SCHEMAVALIDATORH
23 
25 #include "xmlpull/XmlSerializer.h"
29 
30 
31 namespace Schema {
32 
33 //class for validating a schema instance
35 {
36  public:
44  SchemaValidator(const SchemaParser * sp,
45  std::ostream & os = std::cout);
46  ~SchemaValidator();
47 
49 
62  TypeContainer *validate(XmlPullParser * xpp, int typeId,
63  TypeContainer * ipTc = 0);
64 
65  TypeContainer *validate(const std::string & val , int typeId,
66  TypeContainer * ipTc = 0, XmlPullParser * xpp = 0); //for simple types
67  TypeContainer * validate(void* value ,int typeId,
68  TypeContainer * ipTc = 0, XmlPullParser * xpp = 0);
70 
80  bool instance(const std::string& tag,
81  Schema::Type type_id);
82 
84 
85  private:
86 
87  TypeContainer* validateContentModel(XmlPullParser * xpp,
88  ContentModel* cm,
89  TypeContainer * ipTc,
90  const std::string & elemName,
91  bool nested=false,
92  TypeContainer* btCnt=0);//base contentModel
93 
94  void extractSimpleType(const std::string & val, int basetype,
95  TypeContainer * ipTc, const SimpleType * st,
96  XmlPullParser * xpp);
97  bool validateListOrUnion(const SimpleType* st,
98  const std::string &val, XmlPullParser * xpp);
99 
100  bool findElement(ContentModel::ContentsIterator start,
102  std::string name,
104  bool checkAttributeOccurence(const ComplexType* ct ,XmlPullParser* xpp);
105  void instanceCM(ContentModel *cm);
106  void error(const std::string & , XmlPullParser* xpp=0);
107  bool instance1(const std::string& tag, Schema::Type type_id);
108 
109  XmlSerializer * xmlStream_ ;
110  std::ostream &ostr_;
111  const SchemaParser *sParser_;
112 
113 };
114 }
115 #endif
Schema
Definition: Annotation.h:27
Schema::SimpleType
Definition: SimpleType.h:54
Schema::ContentModel::ContentsIterator
std::list< ContentHolder >::iterator ContentsIterator
Definition: ContentModel.h:55
Schema::TypeContainer
Definition: TypeContainer.h:44
TypeContainer.h
Schema::SchemaParser
Definition: SchemaParser.h:43
Schema::ComplexType
Definition: ComplexType.h:35
XmlSerializer.h
SchemaParser.h
WSDLPULL_EXPORT
#define WSDLPULL_EXPORT
Definition: wsdlpull_export.h:33
XmlSerializer
Definition: XmlSerializer.h:33
Schema::Type
Type
Definition: Schema.h:60
wsdlpull_export.h
Schema::SchemaValidator
Definition: SchemaValidator.h:35
XmlPullParser
Definition: XmlPullParser.h:47
SchemaParserException.h
Schema::ContentModel
Definition: ContentModel.h:37