1 | /* |
---|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
---|
3 | * contributor license agreements. See the NOTICE file distributed with |
---|
4 | * this work for additional information regarding copyright ownership. |
---|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
6 | * (the "License"); you may not use this file except in compliance with |
---|
7 | * the License. You may obtain a copy of the License at |
---|
8 | * |
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
10 | * |
---|
11 | * Unless required by applicable law or agreed to in writing, software |
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
14 | * See the License for the specific language governing permissions and |
---|
15 | * limitations under the License. |
---|
16 | */ |
---|
17 | |
---|
18 | /* |
---|
19 | * $Id: XSNamespaceItem.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
20 | */ |
---|
21 | |
---|
22 | #if !defined(XSNAMESPACEITEM_HPP) |
---|
23 | #define XSNAMESPACEITEM_HPP |
---|
24 | |
---|
25 | #include <xercesc/util/PlatformUtils.hpp> |
---|
26 | #include <xercesc/framework/psvi/XSObject.hpp> |
---|
27 | #include <xercesc/framework/psvi/XSNamedMap.hpp> |
---|
28 | |
---|
29 | XERCES_CPP_NAMESPACE_BEGIN |
---|
30 | |
---|
31 | /** |
---|
32 | * This class contains all properties of the Schema Namespace Information infoitem. |
---|
33 | * These items correspond to the result of processing a schema document |
---|
34 | * and all its included/redefined schema documents. It corresponds to the |
---|
35 | * schema component discussed in the schema specifications, but since it |
---|
36 | * is not like other components does not inherit from the XSObject interface. |
---|
37 | * This is *always* owned by the validator /parser object from which |
---|
38 | * it is obtained. It is designed to be subclassed; subclasses will |
---|
39 | * specify under what conditions it may be relied upon to have meaningful contents. |
---|
40 | */ |
---|
41 | |
---|
42 | // forward declarations |
---|
43 | class XSAnnotation; |
---|
44 | class XSAttributeDeclaration; |
---|
45 | class XSAttributeGroupDefinition; |
---|
46 | class XSElementDeclaration; |
---|
47 | class XSModelGroupDefinition; |
---|
48 | class XSNotationDeclaration; |
---|
49 | class XSTypeDefinition; |
---|
50 | class SchemaGrammar; |
---|
51 | class XSModel; |
---|
52 | |
---|
53 | class XMLPARSER_EXPORT XSNamespaceItem : public XMemory |
---|
54 | { |
---|
55 | public: |
---|
56 | |
---|
57 | // Constructors and Destructor |
---|
58 | // ----------------------------------------------------------------------- |
---|
59 | /** @name Constructors */ |
---|
60 | //@{ |
---|
61 | |
---|
62 | /** |
---|
63 | * The default constructor |
---|
64 | * |
---|
65 | * @param xsModel |
---|
66 | * @param grammar |
---|
67 | * @param manager The configurable memory manager |
---|
68 | */ |
---|
69 | XSNamespaceItem |
---|
70 | ( |
---|
71 | XSModel* const xsModel |
---|
72 | , SchemaGrammar* const grammar |
---|
73 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
74 | ); |
---|
75 | |
---|
76 | XSNamespaceItem |
---|
77 | ( |
---|
78 | XSModel* const xsModel |
---|
79 | , const XMLCh* const schemaNamespace |
---|
80 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
81 | ); |
---|
82 | |
---|
83 | //@}; |
---|
84 | |
---|
85 | /** @name Destructor */ |
---|
86 | //@{ |
---|
87 | ~XSNamespaceItem(); |
---|
88 | //@} |
---|
89 | |
---|
90 | //--------------------- |
---|
91 | /** @name XSNamespaceItem methods */ |
---|
92 | |
---|
93 | //@{ |
---|
94 | |
---|
95 | /** |
---|
96 | * [schema namespace]: A namespace name or <code>null</code> |
---|
97 | * corresponding to the target namespace of the schema document. |
---|
98 | */ |
---|
99 | const XMLCh *getSchemaNamespace(); |
---|
100 | |
---|
101 | /** |
---|
102 | * [schema components]: a list of top-level components, i.e. element |
---|
103 | * declarations, attribute declarations, etc. |
---|
104 | * @param objectType The type of the declaration, i.e. |
---|
105 | * <code>ELEMENT_DECLARATION</code>, |
---|
106 | * <code>TYPE_DEFINITION</code> and any other component type that |
---|
107 | * may be a property of a schema component. |
---|
108 | * @return A list of top-level definition of the specified type in |
---|
109 | * <code>objectType</code> or <code>null</code>. |
---|
110 | */ |
---|
111 | XSNamedMap<XSObject> *getComponents(XSConstants::COMPONENT_TYPE objectType); |
---|
112 | |
---|
113 | /** |
---|
114 | * [annotations]: a set of annotations. |
---|
115 | */ |
---|
116 | XSAnnotationList *getAnnotations(); |
---|
117 | |
---|
118 | /** |
---|
119 | * Convenience method. Returns a top-level element declaration. |
---|
120 | * @param name The name of the declaration. |
---|
121 | * @return A top-level element declaration or <code>null</code> if such |
---|
122 | * declaration does not exist. |
---|
123 | */ |
---|
124 | XSElementDeclaration *getElementDeclaration(const XMLCh *name); |
---|
125 | |
---|
126 | /** |
---|
127 | * Convenience method. Returns a top-level attribute declaration. |
---|
128 | * @param name The name of the declaration. |
---|
129 | * @return A top-level attribute declaration or <code>null</code> if such |
---|
130 | * declaration does not exist. |
---|
131 | */ |
---|
132 | XSAttributeDeclaration *getAttributeDeclaration(const XMLCh *name); |
---|
133 | |
---|
134 | /** |
---|
135 | * Convenience method. Returns a top-level simple or complex type |
---|
136 | * definition. |
---|
137 | * @param name The name of the definition. |
---|
138 | * @return An <code>XSTypeDefinition</code> or <code>null</code> if such |
---|
139 | * definition does not exist. |
---|
140 | */ |
---|
141 | XSTypeDefinition *getTypeDefinition(const XMLCh *name); |
---|
142 | |
---|
143 | /** |
---|
144 | * Convenience method. Returns a top-level attribute group definition. |
---|
145 | * @param name The name of the definition. |
---|
146 | * @return A top-level attribute group definition or <code>null</code> if |
---|
147 | * such definition does not exist. |
---|
148 | */ |
---|
149 | XSAttributeGroupDefinition *getAttributeGroup(const XMLCh *name); |
---|
150 | |
---|
151 | /** |
---|
152 | * Convenience method. Returns a top-level model group definition. |
---|
153 | * @param name The name of the definition. |
---|
154 | * @return A top-level model group definition definition or |
---|
155 | * <code>null</code> if such definition does not exist. |
---|
156 | */ |
---|
157 | XSModelGroupDefinition *getModelGroupDefinition(const XMLCh *name); |
---|
158 | |
---|
159 | /** |
---|
160 | * Convenience method. Returns a top-level notation declaration. |
---|
161 | * @param name The name of the declaration. |
---|
162 | * @return A top-level notation declaration or <code>null</code> if such |
---|
163 | * declaration does not exist. |
---|
164 | */ |
---|
165 | XSNotationDeclaration *getNotationDeclaration(const XMLCh *name); |
---|
166 | |
---|
167 | /** |
---|
168 | * [document location] - a list of locations URI for the documents that |
---|
169 | * contributed to the XSModel. |
---|
170 | */ |
---|
171 | StringList *getDocumentLocations(); |
---|
172 | |
---|
173 | //@} |
---|
174 | |
---|
175 | //---------------------------------- |
---|
176 | /** methods needed by implementation */ |
---|
177 | |
---|
178 | //@{ |
---|
179 | |
---|
180 | |
---|
181 | //@} |
---|
182 | private: |
---|
183 | |
---|
184 | // ----------------------------------------------------------------------- |
---|
185 | // Unimplemented constructors and operators |
---|
186 | // ----------------------------------------------------------------------- |
---|
187 | XSNamespaceItem(const XSNamespaceItem&); |
---|
188 | XSNamespaceItem & operator=(const XSNamespaceItem &); |
---|
189 | |
---|
190 | protected: |
---|
191 | friend class XSModel; |
---|
192 | friend class XSObjectFactory; |
---|
193 | // ----------------------------------------------------------------------- |
---|
194 | // data members |
---|
195 | // ----------------------------------------------------------------------- |
---|
196 | // fMemoryManager: |
---|
197 | // used for any memory allocations |
---|
198 | MemoryManager* const fMemoryManager; |
---|
199 | SchemaGrammar* fGrammar; |
---|
200 | XSModel* fXSModel; |
---|
201 | |
---|
202 | /* Need a XSNamedMap for each component top-level? |
---|
203 | that is top level. |
---|
204 | ATTRIBUTE_DECLARATION = 1, |
---|
205 | ELEMENT_DECLARATION = 2, |
---|
206 | TYPE_DEFINITION = 3, |
---|
207 | ATTRIBUTE_USE = 4, no |
---|
208 | ATTRIBUTE_GROUP_DEFINITION= 5, |
---|
209 | MODEL_GROUP_DEFINITION = 6, |
---|
210 | MODEL_GROUP = 7, no |
---|
211 | PARTICLE = 8, no |
---|
212 | WILDCARD = 9, no |
---|
213 | IDENTITY_CONSTRAINT = 10, no |
---|
214 | NOTATION_DECLARATION = 11, |
---|
215 | ANNOTATION = 12, no |
---|
216 | FACET = 13, no |
---|
217 | MULTIVALUE_FACET = 14 no |
---|
218 | */ |
---|
219 | XSNamedMap<XSObject>* fComponentMap[XSConstants::MULTIVALUE_FACET]; |
---|
220 | XSAnnotationList* fXSAnnotationList; |
---|
221 | RefHashTableOf<XSObject>* fHashMap[XSConstants::MULTIVALUE_FACET]; |
---|
222 | const XMLCh* fSchemaNamespace; |
---|
223 | }; |
---|
224 | |
---|
225 | inline XSAnnotationList* XSNamespaceItem::getAnnotations() |
---|
226 | { |
---|
227 | return fXSAnnotationList; |
---|
228 | } |
---|
229 | |
---|
230 | inline const XMLCh *XSNamespaceItem::getSchemaNamespace() |
---|
231 | { |
---|
232 | return fSchemaNamespace; |
---|
233 | } |
---|
234 | |
---|
235 | |
---|
236 | |
---|
237 | XERCES_CPP_NAMESPACE_END |
---|
238 | |
---|
239 | #endif |
---|