1 | /*
|
---|
2 | * The Apache Software License, Version 1.1
|
---|
3 | *
|
---|
4 | * Copyright (c) 1999-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: XMLNotationDecl.hpp,v $
|
---|
59 | * Revision 1.12 2004/02/15 19:37:16 amassari
|
---|
60 | * Removed cause for warnings in VC 7.1
|
---|
61 | *
|
---|
62 | * Revision 1.11 2003/11/21 22:34:46 neilg
|
---|
63 | * More schema component model implementation, thanks to David Cargill.
|
---|
64 | * In particular, this cleans up and completes the XSModel, XSNamespaceItem,
|
---|
65 | * XSAttributeDeclaration and XSAttributeGroup implementations.
|
---|
66 | *
|
---|
67 | * Revision 1.10 2003/11/06 15:30:06 neilg
|
---|
68 | * 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.
|
---|
69 | *
|
---|
70 | * Revision 1.9 2003/10/10 16:23:29 peiyongz
|
---|
71 | * Implementation of Serialization/Deserialization
|
---|
72 | *
|
---|
73 | * Revision 1.8 2003/05/22 02:10:51 knoaman
|
---|
74 | * Default the memory manager.
|
---|
75 | *
|
---|
76 | * Revision 1.7 2003/05/16 21:36:55 knoaman
|
---|
77 | * Memory manager implementation: Modify constructors to pass in the memory manager.
|
---|
78 | *
|
---|
79 | * Revision 1.6 2003/05/15 18:26:07 knoaman
|
---|
80 | * Partial implementation of the configurable memory manager.
|
---|
81 | *
|
---|
82 | * Revision 1.5 2003/04/21 20:46:01 knoaman
|
---|
83 | * Use XMLString::release to prepare for configurable memory manager.
|
---|
84 | *
|
---|
85 | * Revision 1.4 2003/03/07 18:08:10 tng
|
---|
86 | * Return a reference instead of void for operator=
|
---|
87 | *
|
---|
88 | * Revision 1.3 2002/11/04 15:00:21 tng
|
---|
89 | * C++ Namespace Support.
|
---|
90 | *
|
---|
91 | * Revision 1.2 2002/08/22 19:27:41 tng
|
---|
92 | * [Bug 11448] DomCount has problems with XHTML1.1 DTD.
|
---|
93 | *
|
---|
94 | * Revision 1.1.1.1 2002/02/01 22:21:52 peiyongz
|
---|
95 | * sane_include
|
---|
96 | *
|
---|
97 | * Revision 1.5 2000/03/02 19:54:25 roddey
|
---|
98 | * This checkin includes many changes done while waiting for the
|
---|
99 | * 1.1.0 code to be finished. I can't list them all here, but a list is
|
---|
100 | * available elsewhere.
|
---|
101 | *
|
---|
102 | * Revision 1.4 2000/02/24 20:00:23 abagchi
|
---|
103 | * Swat for removing Log from API docs
|
---|
104 | *
|
---|
105 | * Revision 1.3 2000/02/15 01:21:31 roddey
|
---|
106 | * Some initial documentation improvements. More to come...
|
---|
107 | *
|
---|
108 | * Revision 1.2 2000/02/06 07:47:48 rahulj
|
---|
109 | * Year 2K copyright swat.
|
---|
110 | *
|
---|
111 | * Revision 1.1.1.1 1999/11/09 01:08:35 twl
|
---|
112 | * Initial checkin
|
---|
113 | *
|
---|
114 | * Revision 1.2 1999/11/08 20:44:39 rahul
|
---|
115 | * Swat for adding in Product name and CVS comment log variable.
|
---|
116 | *
|
---|
117 | */
|
---|
118 |
|
---|
119 | #if !defined(XMLNOTATIONDECL_HPP)
|
---|
120 | #define XMLNOTATIONDECL_HPP
|
---|
121 |
|
---|
122 | #include <xercesc/util/XMemory.hpp>
|
---|
123 | #include <xercesc/util/PlatformUtils.hpp>
|
---|
124 | #include <xercesc/util/XMLString.hpp>
|
---|
125 | #include <xercesc/internal/XSerializable.hpp>
|
---|
126 |
|
---|
127 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
128 |
|
---|
129 | /**
|
---|
130 | * This class represents the core information about a notation declaration
|
---|
131 | * that all validators must at least support. Each validator will create a
|
---|
132 | * derivative of this class which adds any information it requires for its
|
---|
133 | * own extra needs.
|
---|
134 | *
|
---|
135 | * At this common level, the information supported is the notation name
|
---|
136 | * and the public and sysetm ids indicated in the notation declaration.
|
---|
137 | */
|
---|
138 | class XMLPARSER_EXPORT XMLNotationDecl : public XSerializable, public XMemory
|
---|
139 | {
|
---|
140 | public:
|
---|
141 | // -----------------------------------------------------------------------
|
---|
142 | // Constructors and Destructor
|
---|
143 | // -----------------------------------------------------------------------
|
---|
144 |
|
---|
145 | /** @name Constructors */
|
---|
146 | //@{
|
---|
147 | XMLNotationDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
148 | XMLNotationDecl
|
---|
149 | (
|
---|
150 | const XMLCh* const notName
|
---|
151 | , const XMLCh* const pubId
|
---|
152 | , const XMLCh* const sysId
|
---|
153 | , const XMLCh* const baseURI = 0
|
---|
154 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
155 | );
|
---|
156 | //@}
|
---|
157 |
|
---|
158 | /** @name Destructor */
|
---|
159 | //@{
|
---|
160 | ~XMLNotationDecl();
|
---|
161 | //@}
|
---|
162 |
|
---|
163 |
|
---|
164 | // -----------------------------------------------------------------------
|
---|
165 | // Getter methods
|
---|
166 | // -----------------------------------------------------------------------
|
---|
167 | unsigned int getId() const;
|
---|
168 | const XMLCh* getName() const;
|
---|
169 | const XMLCh* getPublicId() const;
|
---|
170 | const XMLCh* getSystemId() const;
|
---|
171 | const XMLCh* getBaseURI() const;
|
---|
172 | unsigned int getNameSpaceId() const;
|
---|
173 | MemoryManager* getMemoryManager() const;
|
---|
174 |
|
---|
175 |
|
---|
176 | // -----------------------------------------------------------------------
|
---|
177 | // Setter methods
|
---|
178 | // -----------------------------------------------------------------------
|
---|
179 | void setId(const unsigned int newId);
|
---|
180 | void setName
|
---|
181 | (
|
---|
182 | const XMLCh* const notName
|
---|
183 | );
|
---|
184 | void setPublicId(const XMLCh* const newId);
|
---|
185 | void setSystemId(const XMLCh* const newId);
|
---|
186 | void setBaseURI(const XMLCh* const newId);
|
---|
187 | void setNameSpaceId(const unsigned int newId);
|
---|
188 |
|
---|
189 | // -----------------------------------------------------------------------
|
---|
190 | // Support named collection element semantics
|
---|
191 | // -----------------------------------------------------------------------
|
---|
192 | const XMLCh* getKey() const;
|
---|
193 |
|
---|
194 | /***
|
---|
195 | * Support for Serialization/De-serialization
|
---|
196 | ***/
|
---|
197 | DECL_XSERIALIZABLE(XMLNotationDecl)
|
---|
198 |
|
---|
199 | private :
|
---|
200 | // -----------------------------------------------------------------------
|
---|
201 | // Unimplemented constructors and operators
|
---|
202 | // -----------------------------------------------------------------------
|
---|
203 | XMLNotationDecl(const XMLNotationDecl&);
|
---|
204 | XMLNotationDecl& operator=(const XMLNotationDecl&);
|
---|
205 |
|
---|
206 |
|
---|
207 | // -----------------------------------------------------------------------
|
---|
208 | // XMLNotationDecl: Private helper methods
|
---|
209 | // -----------------------------------------------------------------------
|
---|
210 | void cleanUp();
|
---|
211 |
|
---|
212 |
|
---|
213 | // -----------------------------------------------------------------------
|
---|
214 | // Private data members
|
---|
215 | //
|
---|
216 | // fId
|
---|
217 | // This is the unique id given to this notation decl.
|
---|
218 | //
|
---|
219 | // fName
|
---|
220 | // The notation's name, which identifies the type of notation it
|
---|
221 | // applies to.
|
---|
222 | //
|
---|
223 | // fPublicId
|
---|
224 | // The text of the notation's public id, if any.
|
---|
225 | //
|
---|
226 | // fSystemId
|
---|
227 | // The text of the notation's system id, if any.
|
---|
228 | //
|
---|
229 | // fBaseURI
|
---|
230 | // The text of the notation's base URI
|
---|
231 | // -----------------------------------------------------------------------
|
---|
232 | unsigned int fId;
|
---|
233 | XMLCh* fName;
|
---|
234 | XMLCh* fPublicId;
|
---|
235 | XMLCh* fSystemId;
|
---|
236 | XMLCh* fBaseURI;
|
---|
237 | unsigned int fNameSpaceId;
|
---|
238 | MemoryManager* fMemoryManager;
|
---|
239 | };
|
---|
240 |
|
---|
241 |
|
---|
242 | // -----------------------------------------------------------------------
|
---|
243 | // Getter methods
|
---|
244 | // -----------------------------------------------------------------------
|
---|
245 | inline unsigned int XMLNotationDecl::getId() const
|
---|
246 | {
|
---|
247 | return fId;
|
---|
248 | }
|
---|
249 |
|
---|
250 | inline const XMLCh* XMLNotationDecl::getName() const
|
---|
251 | {
|
---|
252 | return fName;
|
---|
253 | }
|
---|
254 |
|
---|
255 | inline unsigned int XMLNotationDecl::getNameSpaceId() const
|
---|
256 | {
|
---|
257 | return fNameSpaceId;
|
---|
258 | }
|
---|
259 |
|
---|
260 | inline const XMLCh* XMLNotationDecl::getPublicId() const
|
---|
261 | {
|
---|
262 | return fPublicId;
|
---|
263 | }
|
---|
264 |
|
---|
265 | inline const XMLCh* XMLNotationDecl::getSystemId() const
|
---|
266 | {
|
---|
267 | return fSystemId;
|
---|
268 | }
|
---|
269 |
|
---|
270 | inline const XMLCh* XMLNotationDecl::getBaseURI() const
|
---|
271 | {
|
---|
272 | return fBaseURI;
|
---|
273 | }
|
---|
274 |
|
---|
275 | inline MemoryManager* XMLNotationDecl::getMemoryManager() const
|
---|
276 | {
|
---|
277 | return fMemoryManager;
|
---|
278 | }
|
---|
279 |
|
---|
280 | // -----------------------------------------------------------------------
|
---|
281 | // Setter methods
|
---|
282 | // -----------------------------------------------------------------------
|
---|
283 | inline void XMLNotationDecl::setId(const unsigned int newId)
|
---|
284 | {
|
---|
285 | fId = newId;
|
---|
286 | }
|
---|
287 |
|
---|
288 | inline void XMLNotationDecl::setNameSpaceId(const unsigned int newId)
|
---|
289 | {
|
---|
290 | fNameSpaceId = newId;
|
---|
291 | }
|
---|
292 |
|
---|
293 | inline void XMLNotationDecl::setPublicId(const XMLCh* const newId)
|
---|
294 | {
|
---|
295 | if (fPublicId)
|
---|
296 | fMemoryManager->deallocate(fPublicId);
|
---|
297 |
|
---|
298 | fPublicId = XMLString::replicate(newId, fMemoryManager);
|
---|
299 | }
|
---|
300 |
|
---|
301 | inline void XMLNotationDecl::setSystemId(const XMLCh* const newId)
|
---|
302 | {
|
---|
303 | if (fSystemId)
|
---|
304 | fMemoryManager->deallocate(fSystemId);
|
---|
305 |
|
---|
306 | fSystemId = XMLString::replicate(newId, fMemoryManager);
|
---|
307 | }
|
---|
308 |
|
---|
309 | inline void XMLNotationDecl::setBaseURI(const XMLCh* const newId)
|
---|
310 | {
|
---|
311 | if (fBaseURI)
|
---|
312 | fMemoryManager->deallocate(fBaseURI);
|
---|
313 |
|
---|
314 | fBaseURI = XMLString::replicate(newId, fMemoryManager);
|
---|
315 | }
|
---|
316 |
|
---|
317 |
|
---|
318 | // ---------------------------------------------------------------------------
|
---|
319 | // XMLNotationDecl: Support named pool element semantics
|
---|
320 | // ---------------------------------------------------------------------------
|
---|
321 | inline const XMLCh* XMLNotationDecl::getKey() const
|
---|
322 | {
|
---|
323 | return fName;
|
---|
324 | }
|
---|
325 |
|
---|
326 | XERCES_CPP_NAMESPACE_END
|
---|
327 |
|
---|
328 | #endif
|
---|