1 | /*
|
---|
2 | * The Apache Software License, Version 1.1
|
---|
3 | *
|
---|
4 | * Copyright (c) 2003 The Apache Software Foundation. All rights
|
---|
5 | * reserved.
|
---|
6 | *
|
---|
7 | * Redistribution and use in source and binary forms, with or without
|
---|
8 | * modification, are permitted provided that the following conditions
|
---|
9 | * are met:
|
---|
10 | *
|
---|
11 | * 1. Redistributions of source code must retain the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer.
|
---|
13 | *
|
---|
14 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
15 | * notice, this list of conditions and the following disclaimer in
|
---|
16 | * the documentation and/or other materials provided with the
|
---|
17 | * distribution.
|
---|
18 | *
|
---|
19 | * 3. The end-user documentation included with the redistribution,
|
---|
20 | * if any, must include the following acknowledgment:
|
---|
21 | * "This product includes software developed by the
|
---|
22 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
23 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
24 | * if and wherever such third-party acknowledgments normally appear.
|
---|
25 | *
|
---|
26 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
27 | * not be used to endorse or promote products derived from this
|
---|
28 | * software without prior written permission. For written
|
---|
29 | * permission, please contact apache\@apache.org.
|
---|
30 | *
|
---|
31 | * 5. Products derived from this software may not be called "Apache",
|
---|
32 | * nor may "Apache" appear in their name, without prior written
|
---|
33 | * permission of the Apache Software Foundation.
|
---|
34 | *
|
---|
35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
38 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
41 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
42 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
43 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
44 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
45 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
46 | * SUCH DAMAGE.
|
---|
47 | * ====================================================================
|
---|
48 | *
|
---|
49 | * This software consists of voluntary contributions made by many
|
---|
50 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
51 | * originally based on software copyright (c) 1999, International
|
---|
52 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
53 | * on the Apache Software Foundation, please see
|
---|
54 | * <http://www.apache.org/>.
|
---|
55 | */
|
---|
56 |
|
---|
57 | /*
|
---|
58 | * $Log: XSNamespaceItem.hpp,v $
|
---|
59 | * Revision 1.8 2003/12/24 17:42:02 knoaman
|
---|
60 | * Misc. PSVI updates
|
---|
61 | *
|
---|
62 | * Revision 1.7 2003/12/01 23:23:26 neilg
|
---|
63 | * fix for bug 25118; thanks to Jeroen Witmond
|
---|
64 | *
|
---|
65 | * Revision 1.6 2003/11/21 22:34:45 neilg
|
---|
66 | * More schema component model implementation, thanks to David Cargill.
|
---|
67 | * In particular, this cleans up and completes the XSModel, XSNamespaceItem,
|
---|
68 | * XSAttributeDeclaration and XSAttributeGroup implementations.
|
---|
69 | *
|
---|
70 | * Revision 1.5 2003/11/21 17:34:04 knoaman
|
---|
71 | * PSVI update
|
---|
72 | *
|
---|
73 | * Revision 1.4 2003/11/14 22:47:53 neilg
|
---|
74 | * fix bogus log message from previous commit...
|
---|
75 | *
|
---|
76 | * Revision 1.3 2003/11/14 22:33:30 neilg
|
---|
77 | * Second phase of schema component model implementation.
|
---|
78 | * Implement XSModel, XSNamespaceItem, and the plumbing necessary
|
---|
79 | * to connect them to the other components.
|
---|
80 | * Thanks to David Cargill.
|
---|
81 | *
|
---|
82 | * Revision 1.2 2003/11/06 15:30:04 neilg
|
---|
83 | * 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.
|
---|
84 | *
|
---|
85 | * Revision 1.1 2003/09/16 14:33:36 neilg
|
---|
86 | * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them
|
---|
87 | *
|
---|
88 | */
|
---|
89 |
|
---|
90 | #if !defined(XSNAMESPACEITEM_HPP)
|
---|
91 | #define XSNAMESPACEITEM_HPP
|
---|
92 |
|
---|
93 | #include <xercesc/util/PlatformUtils.hpp>
|
---|
94 | #include <xercesc/framework/psvi/XSObject.hpp>
|
---|
95 | #include <xercesc/framework/psvi/XSNamedMap.hpp>
|
---|
96 |
|
---|
97 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * This class contains all properties of the Schema Namespace Information infoitem.
|
---|
101 | * These items correspond to the result of processing a schema document
|
---|
102 | * and all its included/redefined schema documents. It corresponds to the
|
---|
103 | * schema component discussed in the schema specifications, but since it
|
---|
104 | * is not like other components does not inherit from the XSObject interface.
|
---|
105 | * This is *always* owned by the validator /parser object from which
|
---|
106 | * it is obtained. It is designed to be subclassed; subclasses will
|
---|
107 | * specify under what conditions it may be relied upon to have meaningful contents.
|
---|
108 | */
|
---|
109 |
|
---|
110 | // forward declarations
|
---|
111 | class XSAnnotation;
|
---|
112 | class XSAttributeDeclaration;
|
---|
113 | class XSAttributeGroupDefinition;
|
---|
114 | class XSElementDeclaration;
|
---|
115 | class XSModelGroupDefinition;
|
---|
116 | class XSNotationDeclaration;
|
---|
117 | class XSTypeDefinition;
|
---|
118 | class SchemaGrammar;
|
---|
119 | class XSModel;
|
---|
120 |
|
---|
121 | class XMLPARSER_EXPORT XSNamespaceItem : public XMemory
|
---|
122 | {
|
---|
123 | public:
|
---|
124 |
|
---|
125 | // Constructors and Destructor
|
---|
126 | // -----------------------------------------------------------------------
|
---|
127 | /** @name Constructors */
|
---|
128 | //@{
|
---|
129 |
|
---|
130 | /**
|
---|
131 | * The default constructor
|
---|
132 | *
|
---|
133 | * @param xsModel
|
---|
134 | * @param grammar
|
---|
135 | * @param manager The configurable memory manager
|
---|
136 | */
|
---|
137 | XSNamespaceItem
|
---|
138 | (
|
---|
139 | XSModel* const xsModel
|
---|
140 | , SchemaGrammar* const grammar
|
---|
141 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
142 | );
|
---|
143 |
|
---|
144 | XSNamespaceItem
|
---|
145 | (
|
---|
146 | XSModel* const xsModel
|
---|
147 | , const XMLCh* const schemaNamespace
|
---|
148 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
149 | );
|
---|
150 |
|
---|
151 | //@};
|
---|
152 |
|
---|
153 | /** @name Destructor */
|
---|
154 | //@{
|
---|
155 | ~XSNamespaceItem();
|
---|
156 | //@}
|
---|
157 |
|
---|
158 | //---------------------
|
---|
159 | /** @name XSNamespaceItem methods */
|
---|
160 |
|
---|
161 | //@{
|
---|
162 |
|
---|
163 | /**
|
---|
164 | * [schema namespace]: A namespace name or <code>null</code>
|
---|
165 | * corresponding to the target namespace of the schema document.
|
---|
166 | */
|
---|
167 | const XMLCh *getSchemaNamespace();
|
---|
168 |
|
---|
169 | /**
|
---|
170 | * [schema components]: a list of top-level components, i.e. element
|
---|
171 | * declarations, attribute declarations, etc.
|
---|
172 | * @param objectType The type of the declaration, i.e.
|
---|
173 | * <code>ELEMENT_DECLARATION</code>,
|
---|
174 | * <code>TYPE_DEFINITION</code> and any other component type that
|
---|
175 | * may be a property of a schema component.
|
---|
176 | * @return A list of top-level definition of the specified type in
|
---|
177 | * <code>objectType</code> or <code>null</code>.
|
---|
178 | */
|
---|
179 | XSNamedMap<XSObject> *getComponents(XSConstants::COMPONENT_TYPE objectType);
|
---|
180 |
|
---|
181 | /**
|
---|
182 | * [annotations]: a set of annotations.
|
---|
183 | */
|
---|
184 | XSAnnotationList *getAnnotations();
|
---|
185 |
|
---|
186 | /**
|
---|
187 | * Convenience method. Returns a top-level element declaration.
|
---|
188 | * @param name The name of the declaration.
|
---|
189 | * @return A top-level element declaration or <code>null</code> if such
|
---|
190 | * declaration does not exist.
|
---|
191 | */
|
---|
192 | XSElementDeclaration *getElementDeclaration(const XMLCh *name);
|
---|
193 |
|
---|
194 | /**
|
---|
195 | * Convenience method. Returns a top-level attribute declaration.
|
---|
196 | * @param name The name of the declaration.
|
---|
197 | * @return A top-level attribute declaration or <code>null</code> if such
|
---|
198 | * declaration does not exist.
|
---|
199 | */
|
---|
200 | XSAttributeDeclaration *getAttributeDeclaration(const XMLCh *name);
|
---|
201 |
|
---|
202 | /**
|
---|
203 | * Convenience method. Returns a top-level simple or complex type
|
---|
204 | * definition.
|
---|
205 | * @param name The name of the definition.
|
---|
206 | * @return An <code>XSTypeDefinition</code> or <code>null</code> if such
|
---|
207 | * definition does not exist.
|
---|
208 | */
|
---|
209 | XSTypeDefinition *getTypeDefinition(const XMLCh *name);
|
---|
210 |
|
---|
211 | /**
|
---|
212 | * Convenience method. Returns a top-level attribute group definition.
|
---|
213 | * @param name The name of the definition.
|
---|
214 | * @return A top-level attribute group definition or <code>null</code> if
|
---|
215 | * such definition does not exist.
|
---|
216 | */
|
---|
217 | XSAttributeGroupDefinition *getAttributeGroup(const XMLCh *name);
|
---|
218 |
|
---|
219 | /**
|
---|
220 | * Convenience method. Returns a top-level model group definition.
|
---|
221 | * @param name The name of the definition.
|
---|
222 | * @return A top-level model group definition definition or
|
---|
223 | * <code>null</code> if such definition does not exist.
|
---|
224 | */
|
---|
225 | XSModelGroupDefinition *getModelGroupDefinition(const XMLCh *name);
|
---|
226 |
|
---|
227 | /**
|
---|
228 | * Convenience method. Returns a top-level notation declaration.
|
---|
229 | * @param name The name of the declaration.
|
---|
230 | * @return A top-level notation declaration or <code>null</code> if such
|
---|
231 | * declaration does not exist.
|
---|
232 | */
|
---|
233 | XSNotationDeclaration *getNotationDeclaration(const XMLCh *name);
|
---|
234 |
|
---|
235 | /**
|
---|
236 | * [document location] - a list of locations URI for the documents that
|
---|
237 | * contributed to the XSModel.
|
---|
238 | */
|
---|
239 | StringList *getDocumentLocations();
|
---|
240 |
|
---|
241 | //@}
|
---|
242 |
|
---|
243 | //----------------------------------
|
---|
244 | /** methods needed by implementation */
|
---|
245 |
|
---|
246 | //@{
|
---|
247 |
|
---|
248 |
|
---|
249 | //@}
|
---|
250 | private:
|
---|
251 |
|
---|
252 | // -----------------------------------------------------------------------
|
---|
253 | // Unimplemented constructors and operators
|
---|
254 | // -----------------------------------------------------------------------
|
---|
255 | XSNamespaceItem(const XSNamespaceItem&);
|
---|
256 | XSNamespaceItem & operator=(const XSNamespaceItem &);
|
---|
257 |
|
---|
258 | protected:
|
---|
259 | friend class XSModel;
|
---|
260 | friend class XSObjectFactory;
|
---|
261 | // -----------------------------------------------------------------------
|
---|
262 | // data members
|
---|
263 | // -----------------------------------------------------------------------
|
---|
264 | // fMemoryManager:
|
---|
265 | // used for any memory allocations
|
---|
266 | MemoryManager* const fMemoryManager;
|
---|
267 | SchemaGrammar* fGrammar;
|
---|
268 | XSModel* fXSModel;
|
---|
269 |
|
---|
270 | /* Need a XSNamedMap for each component top-level?
|
---|
271 | that is top level.
|
---|
272 | ATTRIBUTE_DECLARATION = 1,
|
---|
273 | ELEMENT_DECLARATION = 2,
|
---|
274 | TYPE_DEFINITION = 3,
|
---|
275 | ATTRIBUTE_USE = 4, no
|
---|
276 | ATTRIBUTE_GROUP_DEFINITION= 5,
|
---|
277 | MODEL_GROUP_DEFINITION = 6,
|
---|
278 | MODEL_GROUP = 7, no
|
---|
279 | PARTICLE = 8, no
|
---|
280 | WILDCARD = 9, no
|
---|
281 | IDENTITY_CONSTRAINT = 10, no
|
---|
282 | NOTATION_DECLARATION = 11,
|
---|
283 | ANNOTATION = 12, no
|
---|
284 | FACET = 13, no
|
---|
285 | MULTIVALUE_FACET = 14 no
|
---|
286 | */
|
---|
287 | XSNamedMap<XSObject>* fComponentMap[XSConstants::MULTIVALUE_FACET];
|
---|
288 | XSAnnotationList* fXSAnnotationList;
|
---|
289 | RefHashTableOf<XSObject>* fHashMap[XSConstants::MULTIVALUE_FACET];
|
---|
290 | const XMLCh* fSchemaNamespace;
|
---|
291 | };
|
---|
292 |
|
---|
293 | inline XSAnnotationList* XSNamespaceItem::getAnnotations()
|
---|
294 | {
|
---|
295 | return fXSAnnotationList;
|
---|
296 | }
|
---|
297 |
|
---|
298 | inline const XMLCh *XSNamespaceItem::getSchemaNamespace()
|
---|
299 | {
|
---|
300 | return fSchemaNamespace;
|
---|
301 | }
|
---|
302 |
|
---|
303 |
|
---|
304 |
|
---|
305 | XERCES_CPP_NAMESPACE_END
|
---|
306 |
|
---|
307 | #endif
|
---|