00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096 #if !defined(XSMODEL_HPP)
00097 #define XSMODEL_HPP
00098
00099 #include <xercesc/util/PlatformUtils.hpp>
00100 #include <xercesc/framework/psvi/XSObject.hpp>
00101 #include <xercesc/framework/psvi/XSNamedMap.hpp>
00102
00103 #include <xercesc/util/ValueVectorOf.hpp>
00104 #include <xercesc/validators/schema/SchemaElementDecl.hpp>
00105
00106 XERCES_CPP_NAMESPACE_BEGIN
00107
00120
00121 class Grammar;
00122 class XMLGrammarPool;
00123 class XSAnnotation;
00124 class XSAttributeDeclaration;
00125 class XSAttributeGroupDefinition;
00126 class XSElementDeclaration;
00127 class XSModelGroupDefinition;
00128 class XSNamespaceItem;
00129 class XSNotationDeclaration;
00130 class XSTypeDefinition;
00131 class XSObjectFactory;
00132
00133 class XSModel : public XMemory
00134 {
00135 public:
00136
00137
00138
00141
00147 XSModel( XMLGrammarPool *grammarPool
00148 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00149
00159 XSModel( XSModel *baseModel
00160 , GrammarResolver *grammarResolver
00161 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00162
00164
00167 ~XSModel();
00169
00170
00174
00181 StringList *getNamespaces();
00182
00191 XSNamespaceItemList *getNamespaceItems();
00192
00203 XSNamedMap<XSObject> *getComponents(XSConstants::COMPONENT_TYPE objectType);
00204
00217 XSNamedMap<XSObject> *getComponentsByNamespace(XSConstants::COMPONENT_TYPE objectType,
00218 const XMLCh *compNamespace);
00219
00223 XSAnnotationList *getAnnotations();
00224
00232 XSElementDeclaration *getElementDeclaration(const XMLCh *name
00233 , const XMLCh *compNamespace);
00234
00242 XSAttributeDeclaration *getAttributeDeclaration(const XMLCh *name
00243 , const XMLCh *compNamespace);
00244
00253 XSTypeDefinition *getTypeDefinition(const XMLCh *name
00254 , const XMLCh *compNamespace);
00255
00263 XSAttributeGroupDefinition *getAttributeGroup(const XMLCh *name
00264 , const XMLCh *compNamespace);
00265
00273 XSModelGroupDefinition *getModelGroupDefinition(const XMLCh *name
00274 , const XMLCh *compNamespace);
00275
00283 XSNotationDeclaration *getNotationDeclaration(const XMLCh *name
00284 , const XMLCh *compNamespace);
00285
00295 XSObject *getXSObjectById(unsigned int compId
00296 , XSConstants::COMPONENT_TYPE compType);
00297
00299
00300
00304 XMLStringPool* getURIStringPool();
00305
00306 XSNamespaceItem* getNamespaceItem(const XMLCh* const key);
00307
00315 XSObject* getXSObject(void* key);
00316
00318 private:
00319
00320
00321
00322
00323 void addGrammarToXSModel
00324 (
00325 XSNamespaceItem* namespaceItem
00326 );
00327 void addS4SToXSModel
00328 (
00329 XSNamespaceItem* const namespaceItem
00330 , RefHashTableOf<DatatypeValidator>* const builtInDV
00331 );
00332 void addComponentToNamespace
00333 (
00334 XSNamespaceItem* const namespaceItem
00335 , XSObject* const component
00336 , int componentIndex
00337 , bool addToXSModel = true
00338 );
00339
00340
00341
00342
00343 XSModel(const XSModel&);
00344 XSModel & operator=(const XSModel &);
00345
00346 protected:
00347 friend class XSObjectFactory;
00348
00349
00350
00351
00352
00353
00354 MemoryManager* const fMemoryManager;
00355
00356 StringList* fNamespaceStringList;
00357 XSNamespaceItemList* fXSNamespaceItemList;
00358
00359 RefVectorOf<XSElementDeclaration>* fElementDeclarationVector;
00360 RefVectorOf<XSAttributeDeclaration>* fAttributeDeclarationVector;
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378 XSNamedMap<XSObject>* fComponentMap[XSConstants::MULTIVALUE_FACET];
00379 XMLStringPool* fURIStringPool;
00380 XSAnnotationList* fXSAnnotationList;
00381 RefHashTableOf<XSNamespaceItem>* fHashNamespace;
00382 XSObjectFactory* fObjFactory;
00383 RefVectorOf<XSNamespaceItem>* fDeleteNamespace;
00384 XSModel* fParent;
00385 bool fDeleteParent;
00386 bool fAddedS4SGrammar;
00387 };
00388
00389 inline XMLStringPool* XSModel::getURIStringPool()
00390 {
00391 return fURIStringPool;
00392 }
00393
00394 inline StringList *XSModel::getNamespaces()
00395 {
00396 return fNamespaceStringList;
00397 }
00398
00399 inline XSNamespaceItemList *XSModel::getNamespaceItems()
00400 {
00401 return fXSNamespaceItemList;
00402 }
00403
00404 XERCES_CPP_NAMESPACE_END
00405
00406 #endif