schema.h

00001 /*
00002 
00003 schema.h
00004 
00005 XSD binding schema interface
00006 
00007 --------------------------------------------------------------------------------
00008 gSOAP XML Web services tools
00009 Copyright (C) 2004, Robert van Engelen, Genivia, Inc. All Rights Reserved.
00010 
00011 GPL license.
00012 
00013 This program is free software; you can redistribute it and/or modify it under
00014 the terms of the GNU General Public License as published by the Free Software
00015 Foundation; either version 2 of the License, or (at your option) any later
00016 version.
00017 
00018 This program is distributed in the hope that it will be useful, but WITHOUT ANY
00019 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
00020 PARTICULAR PURPOSE. See the GNU General Public License for more details.
00021 
00022 You should have received a copy of the GNU General Public License along with
00023 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00024 Place, Suite 330, Boston, MA 02111-1307 USA
00025 
00026 Author contact information:
00027 engelen@genivia.com / engelen@acm.org
00028 --------------------------------------------------------------------------------
00029 
00030 */
00031 
00032 //gsoap xs schema documentation:        XSD binding schema
00033 //gsoap xs schema namespace:            http://www.w3.org/2000/10/XMLSchema
00034 /* For the wsdl:arrayType attribute to support old style SOAP arrays: */
00035 //gsoap wsdl schema namespace:          http://schemas.xmlsoap.org/wsdl/
00036 
00037 #import "imports.h"
00038 
00039 class xs__schema;                       // forward declaration
00040 class xs__simpleType;                   // forward declaration
00041 class xs__complexType;                  // forward declaration
00042 class xs__extension;                    // forward declaration
00043 class xs__restriction;                  // forward declaration
00044 class xs__sequence;                     // forward declaration
00045 class xs__choice;                       // forward declaration
00046 class xs__list;                         // forward declaration
00047 class xs__union;                        // forward declaration
00048 
00049 class xs__element
00050 { public:
00051         // @xsd__ID                     id;
00052         @xsd__NCName                    name;
00053         @xsd__QName                     ref;
00054         @xsd__QName                     type;
00055         @xsd__string                    default_;
00056         @xsd__string                    fixed;
00057         @xsd__boolean                   nillable                = false;
00058         @xsd__string                    minOccurs;              // xsd:nonNegativeInteger
00059         @xsd__string                    maxOccurs;              // xsd:nonNegativeInteger|unbounded
00060         xs__simpleType                  *simpleType;            // choice
00061         xs__complexType                 *complexType;           // choice
00062   private:
00063         xs__schema                      *schemaRef;             // schema to which this belongs
00064         xs__element                     *elementRef;            // traverse() finds ref
00065         xs__simpleType                  *simpleTypeRef;         // traverse() finds type or = simpleType above
00066         xs__complexType                 *complexTypeRef;        // traverse() finds type or = complexType above
00067   public:
00068                                         xs__element();
00069                                         ~xs__element();
00070         int                             traverse(xs__schema&);
00071         void                            schemaPtr(xs__schema*);
00072         void                            elementPtr(xs__element*);
00073         void                            simpleTypePtr(xs__simpleType*);
00074         void                            complexTypePtr(xs__complexType*);
00075         xs__schema                      *schemaPtr() const;
00076         xs__element                     *elementPtr() const;
00077         xs__simpleType                  *simpleTypePtr() const;
00078         xs__complexType                 *complexTypePtr() const;
00079 };
00080 
00081 enum xs__attribute_use { optional, prohibited, required, default_, fixed_ };
00082 
00083 class xs__attribute
00084 { public:
00085         @xsd__NCName                    name;
00086         @xsd__QName                     ref;
00087         @xsd__QName                     type;
00088         @enum xs__attribute_use         use                     = optional;
00089         @xsd__string                    value;
00090         @xsd__QName                     wsdl__arrayType;        // extensibility attribute added to simplify WSDL parsing
00091         xs__simpleType                  *simpleType;
00092   private:
00093         xs__schema                      *schemaRef;             // schema to which this belongs
00094         xs__attribute                   *attributeRef;          // traverse() finds ref
00095         xs__simpleType                  *simpleTypeRef;         // traverse() finds type or = simpleType above
00096   public:
00097         int                             traverse(xs__schema&);
00098         void                            schemaPtr(xs__schema*);
00099         void                            attributePtr(xs__attribute*);
00100         void                            simpleTypePtr(xs__simpleType*);
00101         xs__schema                      *schemaPtr() const;
00102         xs__attribute                   *attributePtr() const;
00103         xs__simpleType                  *simpleTypePtr() const;
00104 };
00105 
00106 class xs__all
00107 { public:
00108         std::vector<xs__element>        element;
00109   public:
00110         int                             traverse(xs__schema&);
00111 };
00112 
00113 enum xs__processContents { strict, skip, lax };
00114 
00115 typedef char *xs__namespaceList;        // "##any" or "##other" or list of URI, "##targetNamespace", "##local"
00116 
00117 class xs__any
00118 { public:
00119         @xs__namespaceList              namespace_              = "##any";
00120         @enum xs__processContents       processContents         = strict;
00121         @xsd__string                    minOccurs;              // xsd:nonNegativeInteger
00122         @xsd__string                    maxOccurs;              // xsd:nonNegativeInteger|unbounded
00123         std::vector<xs__element>        element;
00124   public:
00125         int                             traverse(xs__schema&);
00126 };
00127 
00128 class xs__group
00129 { public:
00130         @xsd__NCName                    name;
00131         @xsd__QName                     ref;
00132         xs__all                         *all;                   // choice
00133         xs__choice                      *choice;                // choice
00134         xs__sequence                    *sequence;              // choice
00135   private:
00136         xs__schema                      *schemaRef;             // schema to which this belongs
00137         xs__group                       *groupRef;              // traverse() finds ref
00138   public:
00139         int                             traverse(xs__schema&);
00140         void                            schemaPtr(xs__schema*);
00141         void                            groupPtr(xs__group*);
00142         xs__schema                      *schemaPtr() const;
00143         xs__group                       *groupPtr() const;
00144 };
00145 
00146 class xs__choice
00147 { public:
00148         @xsd__string                    minOccurs;              // xsd:nonNegativeInteger
00149         @xsd__string                    maxOccurs;              // xsd:nonNegativeInteger|unbounded
00150         std::vector<xs__element>        element;
00151         std::vector<xs__group>          group;
00152         //std::vector<xs__choice>               choice;
00153         std::vector<xs__sequence*>      sequence;
00154         std::vector<xs__any>            any;
00155   public:
00156         int                             traverse(xs__schema&);
00157 };
00158 
00159 class xs__sequence
00160 { public:
00161         @xsd__string                    minOccurs;              // xsd:nonNegativeInteger
00162         @xsd__string                    maxOccurs;              // xsd:nonNegativeInteger|unbounded
00163         std::vector<xs__element>        element;
00164         std::vector<xs__group>          group;
00165         std::vector<xs__choice>         choice;
00166         //std::vector<xs__sequence>     sequence;
00167         std::vector<xs__any>            any;
00168   public:
00169         int                             traverse(xs__schema&);
00170 };
00171 
00172 class xs__attributeGroup
00173 { public:
00174         @xsd__NCName                    name;
00175         @xsd__QName                     ref;
00176         std::vector<xs__attribute>      attribute;
00177   private:
00178         xs__schema                      *schemaRef;
00179         xs__attributeGroup              *attributeGroupRef;
00180   public:
00181         int                             traverse(xs__schema&);
00182         void                            schemaPtr(xs__schema*);
00183         void                            attributeGroupPtr(xs__attributeGroup*);
00184         xs__schema                      *schemaPtr() const;
00185         xs__attributeGroup              *attributeGroupPtr() const;
00186 };
00187 
00188 class xs__anyAttribute
00189 { public:
00190         @xs__namespaceList              namespace_              = "##any";
00191         @enum xs__processContents       processContents         = strict;
00192 };
00193 
00194 class xs__enumeration
00195 { public:
00196         @xsd__string                    value;
00197   public:
00198         int                             traverse(xs__schema&);
00199 };
00200 
00201 class xs__pattern
00202 { public:
00203         @xsd__string                    value;
00204   public:
00205         int                             traverse(xs__schema&);
00206 };
00207 
00208 class xs__simpleContent
00209 { public:
00210         xs__extension                   *extension;     // choice
00211         xs__restriction                 *restriction;   // choice
00212   public:
00213         int                             traverse(xs__schema&);
00214 };
00215 
00216 class xs__simpleType
00217 { public:
00218         @xsd__NMTOKEN                   name;
00219         xs__restriction                 *restriction;   // choice
00220         xs__list                        *list;          // choice
00221         xs__union                       *union_;        // choice
00222   private:
00223         xs__schema                      *schemaRef;
00224         int                             level;
00225   public:
00226                                         xs__simpleType();
00227                                         ~xs__simpleType();
00228         int                             traverse(xs__schema&);
00229         void                            schemaPtr(xs__schema*);
00230         xs__schema                      *schemaPtr() const;
00231         int                             baseLevel();
00232 };
00233 
00234 class xs__extension
00235 { public:
00236         @xsd__QName                     base;
00237         xs__group                       *group;
00238         xs__all                         *all;
00239         xs__choice                      *choice;
00240         xs__sequence                    *sequence;
00241         std::vector<xs__attribute>      attribute;
00242   private:
00243         xs__simpleType                  *simpleTypeRef;         // traverse() finds type
00244         xs__complexType                 *complexTypeRef;        // traverse() finds type
00245   public:
00246         int                             traverse(xs__schema&);
00247         void                            simpleTypePtr(xs__simpleType*);
00248         void                            complexTypePtr(xs__complexType*);
00249         xs__simpleType                  *simpleTypePtr() const;
00250         xs__complexType                 *complexTypePtr() const;
00251 };
00252 
00253 class xs__length
00254 { public:
00255         @xsd__string                    value;
00256 };
00257 
00258 class xs__whiteSpace
00259 { public:
00260         @xsd__string                    value;
00261 };
00262 
00263 class xs__restriction
00264 { public:
00265         @xsd__QName                     base;
00266         xs__group                       *group;         // not used in <simpleType><restriction>
00267         xs__all                         *all;           // not used in <simpleType><restriction>
00268         xs__choice                      *choice;        // not used in <simpleType><restriction>
00269         xs__sequence                    *sequence;      // not used in <simpleType><restriction>
00270         std::vector<xs__attribute>      attribute;      // not used in <simpleType><restriction>
00271         std::vector<xs__enumeration>    enumeration;
00272         std::vector<xs__pattern>        pattern;
00273         xs__length                      *minLength;
00274         xs__length                      *maxLength;
00275         xs__whiteSpace                  *whiteSpace;
00276   private:
00277         xs__simpleType                  *simpleTypeRef;         // traverse() finds type
00278         xs__complexType                 *complexTypeRef;        // traverse() finds type
00279   public:
00280         int                             traverse(xs__schema&);
00281         void                            simpleTypePtr(xs__simpleType*);
00282         void                            complexTypePtr(xs__complexType*);
00283         xs__simpleType                  *simpleTypePtr() const;
00284         xs__complexType                 *complexTypePtr() const;
00285 };
00286 
00287 class xs__list
00288 { public:
00289         @xsd__QName                     itemType;
00290         xs__restriction                 *restriction;   // choice
00291         std::vector<xs__simpleType>     simpleType;     // choice
00292   private:
00293         xs__simpleType                  *itemTypeRef;
00294   public:
00295         int                             traverse(xs__schema&);
00296         void                            itemTypePtr(xs__simpleType*);
00297         xs__simpleType                  *itemTypePtr() const;
00298 };
00299 
00300 class xs__union
00301 { public:
00302         @xsd__NMTOKENS                  memberTypes;    // check if NMTOKENS is ok???
00303         std::vector<xs__simpleType>     simpleType;
00304   public:
00305         int                             traverse(xs__schema&);
00306 };
00307 
00308 class xs__complexContent
00309 { public:
00310         @xsd__boolean                   mixed                   = false;
00311         xs__extension                   *extension;
00312         xs__restriction                 *restriction;
00313   public:
00314         int                             traverse(xs__schema&);
00315 };
00316 
00317 class xs__complexType
00318 { public:
00319         @xsd__NMTOKEN                   name;
00320         @xsd__boolean                   abstract                = false;
00321         xs__simpleContent               *simpleContent;
00322         xs__complexContent              *complexContent;
00323         xs__all                         *all;
00324         xs__choice                      *choice;
00325         xs__sequence                    *sequence;
00326         xs__any                         *any;
00327         std::vector<xs__attribute>      attribute;
00328         std::vector<xs__attributeGroup> attributeGroup;
00329         xs__anyAttribute                *anyAttribute;
00330   private:
00331         xs__schema                      *schemaRef;
00332         int                             level;
00333   public:
00334                                         xs__complexType();
00335                                         ~xs__complexType();
00336         int                             traverse(xs__schema&);
00337         void                            schemaPtr(xs__schema*);
00338         xs__schema                      *schemaPtr() const;
00339         int                             baseLevel();
00340 };
00341 
00342 class xs__import
00343 { public:
00344         @xsd__anyURI                    namespace_;
00345         @xsd__anyURI                    schemaLocation;
00346   private:
00347         xs__schema                      *schemaRef;             // set by WSDL parser or via schemaLocation
00348   public:
00349                                         xs__import();
00350                                         ~xs__import();
00351         int                             traverse(xs__schema&);
00352         void                            schemaPtr(xs__schema*);
00353         xs__schema                      *schemaPtr() const;
00354 };
00355 
00356 class xs__include
00357 { public:
00358         @xsd__anyURI                    schemaLocation;
00359   private:
00360         xs__schema                      *schemaRef;             // set by WSDL parser or via schemaLocation
00361   public:
00362         int                             traverse(xs__schema&);
00363         void                            schemaPtr(xs__schema*);
00364         xs__schema                      *schemaPtr() const;
00365 };
00366         
00367 enum xs__formChoice { unqualified, qualified };
00368 
00369 class xs__schema
00370 { public:
00371         @xsd__anyURI                    targetNamespace;
00372         @xsd__string                    version;
00373         @enum xs__formChoice            attributeFormDefault    = unqualified;
00374         @enum xs__formChoice            elementFormDefault      = unqualified;
00375         std::vector<xs__include>        include;
00376         std::vector<xs__import>         import;
00377         std::vector<xs__attribute>      attribute;
00378         std::vector<xs__element>        element;
00379         std::vector<xs__group>          group;
00380         std::vector<xs__attributeGroup> attributeGroup;
00381         std::vector<xs__simpleType>     simpleType;
00382         std::vector<xs__complexType>    complexType;
00383         struct soap                     *soap;
00384   private:
00385         SetOfString                     builtinTypeSet;
00386         SetOfString                     builtinElementSet;
00387         SetOfString                     builtinAttributeSet;
00388   public:
00389                                         xs__schema();
00390                                         xs__schema(struct soap*);
00391                                         xs__schema(struct soap*, const char*);
00392                                         ~xs__schema();
00393         int                             traverse();
00394         int                             read(const char*);
00395         int                             error();
00396         void                            print_fault();
00397         void                            builtinType(const char*);
00398         void                            builtinElement(const char*);
00399         void                            builtinAttribute(const char*);
00400         const SetOfString&              builtinTypes() const;
00401         const SetOfString&              builtinElements() const;
00402         const SetOfString&              builtinAttributes() const;
00403         friend ostream&                 operator<<(ostream&, const xs__schema&);
00404         friend istream&                 operator>>(istream&, xs__schema&);
00405 };
00406 
00407 extern ostream &operator<<(ostream &o, const xs__schema &e);
00408 extern istream &operator>>(istream &i, xs__schema &e);
00409 

Generated on Mon Jun 5 10:20:42 2006 for Intelligence.kdevelop by  doxygen 1.4.6