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