| API Docs for SAX and DOM |
| Main Page Classes Files Related Pages # XSModel.hpp Go to the documentation of this file.
    00001 /*
    00002  * Licensed to the Apache Software Foundation (ASF) under one or more
    00003  * contributor license agreements.  See the NOTICE file distributed with
    00004  * this work for additional information regarding copyright ownership.
    00005  * The ASF licenses this file to You under the Apache License, Version 2.0
    00006  * (the "License"); you may not use this file except in compliance with
    00007  * the License.  You may obtain a copy of the License at
    00008  *
    00009  *      http://www.apache.org/licenses/LICENSE-2.0
    00010  *
    00011  * Unless required by applicable law or agreed to in writing, software
    00012  * distributed under the License is distributed on an "AS IS" BASIS,
    00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00014  * See the License for the specific language governing permissions and
    00015  * limitations under the License.
    00016  */
    00017
    00018 /*
    00019  * $Id: XSModel.hpp 568078 2007-08-21 11:43:25Z amassari $
    00020  */
    00021
    00022 #if !defined(XSMODEL_HPP)
    00023 #define XSMODEL_HPP
    00024
    00025 #include <xercesc/util/PlatformUtils.hpp>
    00026 #include <xercesc/framework/psvi/XSObject.hpp>
    00027 #include <xercesc/framework/psvi/XSNamedMap.hpp>
    00028
    00029 #include <xercesc/util/ValueVectorOf.hpp>
    00030 #include <xercesc/validators/schema/SchemaElementDecl.hpp>
    00031
    00032 XERCES_CPP_NAMESPACE_BEGIN
    00033
    00046 // forward declarations
    00047 class Grammar;
    00048 class XMLGrammarPool;
    00049 class XSAnnotation;
    00050 class XSAttributeDeclaration;
    00051 class XSAttributeGroupDefinition;
    00052 class XSElementDeclaration;
    00053 class XSModelGroupDefinition;
    00054 class XSNamespaceItem;
    00055 class XSNotationDeclaration;
    00056 class XSTypeDefinition;
    00057 class XSObjectFactory;
    00058
    00059 class  XSModel : public XMemory
    00060 {
    00061 public:
    00062
    00063     //  Constructors and Destructor
    00064     // -----------------------------------------------------------------------
    00067
    00073     XSModel( XMLGrammarPool *grammarPool
    00074                 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00075
    00085     XSModel( XSModel *baseModel
    00086                 , GrammarResolver *grammarResolver
    00087                 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
    00088
    00090
    00093     ~XSModel();
    00095
    00096     //---------------------
    00100
    00107     StringList *getNamespaces();
    00108
    00117     XSNamespaceItemList *getNamespaceItems();
    00118
    00129     XSNamedMap<XSObject> *getComponents(XSConstants::COMPONENT_TYPE objectType);
    00130
    00143     XSNamedMap<XSObject> *getComponentsByNamespace(XSConstants::COMPONENT_TYPE objectType,
    00144                                                const XMLCh *compNamespace);
    00145
    00149     XSAnnotationList *getAnnotations();
    00150
    00158     XSElementDeclaration *getElementDeclaration(const XMLCh *name
    00159             , const XMLCh *compNamespace);
    00160
    00168     XSAttributeDeclaration *getAttributeDeclaration(const XMLCh *name
    00169             , const XMLCh *compNamespace);
    00170
    00179     XSTypeDefinition *getTypeDefinition(const XMLCh *name
    00180             , const XMLCh *compNamespace);
    00181
    00189     XSAttributeGroupDefinition *getAttributeGroup(const XMLCh *name
    00190             , const XMLCh *compNamespace);
    00191
    00199     XSModelGroupDefinition *getModelGroupDefinition(const XMLCh *name
    00200             , const XMLCh *compNamespace);
    00201
    00209     XSNotationDeclaration *getNotationDeclaration(const XMLCh *name
    00210             , const XMLCh *compNamespace);
    00211
    00221     XSObject *getXSObjectById(unsigned int  compId
    00222                 , XSConstants::COMPONENT_TYPE compType);
    00223
    00225
    00226     //----------------------------------
    00230     XMLStringPool*  getURIStringPool();
    00231
    00232     XSNamespaceItem* getNamespaceItem(const XMLCh* const key);
    00233
    00241     XSObject* getXSObject(void* key);
    00242
    00244 private:
    00245
    00246     // -----------------------------------------------------------------------
    00247     //  Helper methods
    00248     // -----------------------------------------------------------------------
    00249     void addGrammarToXSModel
    00250     (
    00251         XSNamespaceItem* namespaceItem
    00252     );
    00253     void addS4SToXSModel
    00254     (
    00255         XSNamespaceItem* const namespaceItem
    00256         , RefHashTableOf<DatatypeValidator>* const builtInDV
    00257     );
    00258     void addComponentToNamespace
    00259     (
    00260          XSNamespaceItem* const namespaceItem
    00261          , XSObject* const component
    00262          , int componentIndex
    00263          , bool addToXSModel = true
    00264     );
    00265
    00266     void addComponentToIdVector
    00267     (
    00268         XSObject* const component
    00269         , int componentIndex
    00270     );
    00271
    00272     // -----------------------------------------------------------------------
    00273     //  Unimplemented constructors and operators
    00274     // -----------------------------------------------------------------------
    00275     XSModel(const XSModel&);
    00276     XSModel & operator=(const XSModel &);
    00277
    00278 protected:
    00279     friend class XSObjectFactory;
    00280     friend class XSObject;
    00281
    00282     // -----------------------------------------------------------------------
    00283     //  data members
    00284     // -----------------------------------------------------------------------
    00285     // fMemoryManager:
    00286     //  used for any memory allocations
    00287     MemoryManager* const                    fMemoryManager;
    00288
    00289     StringList*                             fNamespaceStringList;
    00290     XSNamespaceItemList*                    fXSNamespaceItemList;
    00291
    00292     RefVectorOf<XSObject>*                  fIdVector[XSConstants::MULTIVALUE_FACET];
    00293
    00294     /* Need a XSNamedMap for each component    top-level?
    00295           ATTRIBUTE_DECLARATION     = 1,
    00296           ELEMENT_DECLARATION       = 2,
    00297           TYPE_DEFINITION           = 3,
    00298           ATTRIBUTE_USE             = 4,       no
    00299           ATTRIBUTE_GROUP_DEFINITION= 5,
    00300           MODEL_GROUP_DEFINITION    = 6,
    00301           MODEL_GROUP               = 7,       no
    00302           PARTICLE                  = 8,       no
    00303           WILDCARD                  = 9,       no
    00304           IDENTITY_CONSTRAINT       = 10,      no
    00305           NOTATION_DECLARATION      = 11,
    00306           ANNOTATION                = 12,      no
    00307           FACET                     = 13,      no
    00308           MULTIVALUE_FACET          = 14       no
    00309     */
    00310     XSNamedMap<XSObject>*                   fComponentMap[XSConstants::MULTIVALUE_FACET];
    00311     XMLStringPool*                          fURIStringPool;
    00312     XSAnnotationList*                       fXSAnnotationList;
    00313     RefHashTableOf<XSNamespaceItem>*        fHashNamespace;
    00314     XSObjectFactory*                        fObjFactory;
    00315     RefVectorOf<XSNamespaceItem>*           fDeleteNamespace;
    00316     XSModel*                                fParent;
    00317     bool                                    fDeleteParent;
    00318     bool                                    fAddedS4SGrammar;
    00319 };
    00320
    00321 inline XMLStringPool*  XSModel::getURIStringPool()
    00322 {
    00323     return fURIStringPool;
    00324 }
    00325
    00326 inline StringList *XSModel::getNamespaces()
    00327 {
    00328     return fNamespaceStringList;
    00329 }
    00330
    00331 inline XSNamespaceItemList *XSModel::getNamespaceItems()
    00332 {
    00333     return fXSNamespaceItemList;
    00334 }
    00335
    00336 XERCES_CPP_NAMESPACE_END
    00337
    00338 #endif

Copyright © 1994-2004 The Apache Software Foundation. All Rights Reserved.