00001 /* 00002 * Copyright 2003,2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 /* 00018 * $Log: XSNamespaceItem.hpp,v $ 00019 * Revision 1.9 2004/09/08 13:56:09 peiyongz 00020 * Apache License Version 2.0 00021 * 00022 * Revision 1.8 2003/12/24 17:42:02 knoaman 00023 * Misc. PSVI updates 00024 * 00025 * Revision 1.7 2003/12/01 23:23:26 neilg 00026 * fix for bug 25118; thanks to Jeroen Witmond 00027 * 00028 * Revision 1.6 2003/11/21 22:34:45 neilg 00029 * More schema component model implementation, thanks to David Cargill. 00030 * In particular, this cleans up and completes the XSModel, XSNamespaceItem, 00031 * XSAttributeDeclaration and XSAttributeGroup implementations. 00032 * 00033 * Revision 1.5 2003/11/21 17:34:04 knoaman 00034 * PSVI update 00035 * 00036 * Revision 1.4 2003/11/14 22:47:53 neilg 00037 * fix bogus log message from previous commit... 00038 * 00039 * Revision 1.3 2003/11/14 22:33:30 neilg 00040 * Second phase of schema component model implementation. 00041 * Implement XSModel, XSNamespaceItem, and the plumbing necessary 00042 * to connect them to the other components. 00043 * Thanks to David Cargill. 00044 * 00045 * Revision 1.2 2003/11/06 15:30:04 neilg 00046 * first part of PSVI/schema component model implementation, thanks to David Cargill. This covers setting the PSVIHandler on parser objects, as well as implementing XSNotation, XSSimpleTypeDefinition, XSIDCDefinition, and most of XSWildcard, XSComplexTypeDefinition, XSElementDeclaration, XSAttributeDeclaration and XSAttributeUse. 00047 * 00048 * Revision 1.1 2003/09/16 14:33:36 neilg 00049 * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them 00050 * 00051 */ 00052 00053 #if !defined(XSNAMESPACEITEM_HPP) 00054 #define XSNAMESPACEITEM_HPP 00055 00056 #include <xercesc/util/PlatformUtils.hpp> 00057 #include <xercesc/framework/psvi/XSObject.hpp> 00058 #include <xercesc/framework/psvi/XSNamedMap.hpp> 00059 00060 XERCES_CPP_NAMESPACE_BEGIN 00061 00073 // forward declarations 00074 class XSAnnotation; 00075 class XSAttributeDeclaration; 00076 class XSAttributeGroupDefinition; 00077 class XSElementDeclaration; 00078 class XSModelGroupDefinition; 00079 class XSNotationDeclaration; 00080 class XSTypeDefinition; 00081 class SchemaGrammar; 00082 class XSModel; 00083 00084 class XSNamespaceItem : public XMemory 00085 { 00086 public: 00087 00088 // Constructors and Destructor 00089 // ----------------------------------------------------------------------- 00092 00100 XSNamespaceItem 00101 ( 00102 XSModel* const xsModel 00103 , SchemaGrammar* const grammar 00104 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00105 ); 00106 00107 XSNamespaceItem 00108 ( 00109 XSModel* const xsModel 00110 , const XMLCh* const schemaNamespace 00111 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00112 ); 00113 00115 00118 ~XSNamespaceItem(); 00120 00121 //--------------------- 00125 00130 const XMLCh *getSchemaNamespace(); 00131 00142 XSNamedMap<XSObject> *getComponents(XSConstants::COMPONENT_TYPE objectType); 00143 00147 XSAnnotationList *getAnnotations(); 00148 00155 XSElementDeclaration *getElementDeclaration(const XMLCh *name); 00156 00163 XSAttributeDeclaration *getAttributeDeclaration(const XMLCh *name); 00164 00172 XSTypeDefinition *getTypeDefinition(const XMLCh *name); 00173 00180 XSAttributeGroupDefinition *getAttributeGroup(const XMLCh *name); 00181 00188 XSModelGroupDefinition *getModelGroupDefinition(const XMLCh *name); 00189 00196 XSNotationDeclaration *getNotationDeclaration(const XMLCh *name); 00197 00202 StringList *getDocumentLocations(); 00203 00205 00206 //---------------------------------- 00210 00211 00213 private: 00214 00215 // ----------------------------------------------------------------------- 00216 // Unimplemented constructors and operators 00217 // ----------------------------------------------------------------------- 00218 XSNamespaceItem(const XSNamespaceItem&); 00219 XSNamespaceItem & operator=(const XSNamespaceItem &); 00220 00221 protected: 00222 friend class XSModel; 00223 friend class XSObjectFactory; 00224 // ----------------------------------------------------------------------- 00225 // data members 00226 // ----------------------------------------------------------------------- 00227 // fMemoryManager: 00228 // used for any memory allocations 00229 MemoryManager* const fMemoryManager; 00230 SchemaGrammar* fGrammar; 00231 XSModel* fXSModel; 00232 00233 /* Need a XSNamedMap for each component top-level? 00234 that is top level. 00235 ATTRIBUTE_DECLARATION = 1, 00236 ELEMENT_DECLARATION = 2, 00237 TYPE_DEFINITION = 3, 00238 ATTRIBUTE_USE = 4, no 00239 ATTRIBUTE_GROUP_DEFINITION= 5, 00240 MODEL_GROUP_DEFINITION = 6, 00241 MODEL_GROUP = 7, no 00242 PARTICLE = 8, no 00243 WILDCARD = 9, no 00244 IDENTITY_CONSTRAINT = 10, no 00245 NOTATION_DECLARATION = 11, 00246 ANNOTATION = 12, no 00247 FACET = 13, no 00248 MULTIVALUE_FACET = 14 no 00249 */ 00250 XSNamedMap<XSObject>* fComponentMap[XSConstants::MULTIVALUE_FACET]; 00251 XSAnnotationList* fXSAnnotationList; 00252 RefHashTableOf<XSObject>* fHashMap[XSConstants::MULTIVALUE_FACET]; 00253 const XMLCh* fSchemaNamespace; 00254 }; 00255 00256 inline XSAnnotationList* XSNamespaceItem::getAnnotations() 00257 { 00258 return fXSAnnotationList; 00259 } 00260 00261 inline const XMLCh *XSNamespaceItem::getSchemaNamespace() 00262 { 00263 return fSchemaNamespace; 00264 } 00265 00266 00267 00268 XERCES_CPP_NAMESPACE_END 00269 00270 #endif