1 | /*
|
---|
2 | * The Apache Software License, Version 1.1
|
---|
3 | *
|
---|
4 | * Copyright (c) 1999-2001 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: DTDGrammar.hpp,v $
|
---|
59 | * Revision 1.14 2004/01/29 11:52:30 cargilld
|
---|
60 | * Code cleanup changes to get rid of various compiler diagnostic messages.
|
---|
61 | *
|
---|
62 | * Revision 1.13 2003/12/22 15:22:58 gareth
|
---|
63 | * made getRootElemID const. Bug #25699
|
---|
64 | *
|
---|
65 | * Revision 1.12 2003/12/17 00:18:40 cargilld
|
---|
66 | * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data.
|
---|
67 | *
|
---|
68 | * Revision 1.11 2003/10/14 15:20:42 peiyongz
|
---|
69 | * Implementation of Serialization/Deserialization
|
---|
70 | *
|
---|
71 | * Revision 1.10 2003/09/22 19:49:02 neilg
|
---|
72 | * implement change to Grammar::putElem(XMLElementDecl, bool). If Grammars are used only to hold declared objects, there will be no need for the fElemNonDeclPool tables; make Grammar implementations lazily create them only if the application requires them (which good cpplications should not.)
|
---|
73 | *
|
---|
74 | * Revision 1.9 2003/08/14 03:00:46 knoaman
|
---|
75 | * Code refactoring to improve performance of validation.
|
---|
76 | *
|
---|
77 | * Revision 1.8 2003/07/31 17:09:59 peiyongz
|
---|
78 | * Grammar embed grammar description
|
---|
79 | *
|
---|
80 | * Revision 1.7 2003/05/16 21:43:19 knoaman
|
---|
81 | * Memory manager implementation: Modify constructors to pass in the memory manager.
|
---|
82 | *
|
---|
83 | * Revision 1.6 2003/05/15 18:54:50 knoaman
|
---|
84 | * Partial implementation of the configurable memory manager.
|
---|
85 | *
|
---|
86 | * Revision 1.5 2002/11/04 14:50:40 tng
|
---|
87 | * C++ Namespace Support.
|
---|
88 | *
|
---|
89 | * Revision 1.4 2002/08/22 15:05:39 tng
|
---|
90 | * Remove unused parameter variables in inline functions.
|
---|
91 | *
|
---|
92 | * Revision 1.3 2002/07/11 18:19:28 knoaman
|
---|
93 | * Grammar caching/preparsing - initial implementation.
|
---|
94 | *
|
---|
95 | * Revision 1.2 2002/07/05 17:08:10 tng
|
---|
96 | * [Bug 10119] Grammar::getGrammarType need a const modifier
|
---|
97 | *
|
---|
98 | * Revision 1.1.1.1 2002/02/01 22:22:43 peiyongz
|
---|
99 | * sane_include
|
---|
100 | *
|
---|
101 | * Revision 1.5 2001/09/14 14:50:22 tng
|
---|
102 | * Schema: Fix some wildcard bugs, and some retrieving qualified/unqualified element decl problems.
|
---|
103 | *
|
---|
104 | * Revision 1.4 2001/05/28 20:56:17 tng
|
---|
105 | * Schema: Move getTargetNamespace as virtual function in base class Grammar
|
---|
106 | *
|
---|
107 | * Revision 1.3 2001/05/11 13:27:09 tng
|
---|
108 | * Copyright update.
|
---|
109 | *
|
---|
110 | * Revision 1.2 2001/04/19 18:17:21 tng
|
---|
111 | * Schema: SchemaValidator update, and use QName in Content Model
|
---|
112 | *
|
---|
113 | * Revision 1.1 2001/03/21 21:56:20 tng
|
---|
114 | * Schema: Add Schema Grammar, Schema Validator, and split the DTDValidator into DTDValidator, DTDScanner, and DTDGrammar.
|
---|
115 | *
|
---|
116 | */
|
---|
117 |
|
---|
118 |
|
---|
119 |
|
---|
120 | #if !defined(DTDGRAMMAR_HPP)
|
---|
121 | #define DTDGRAMMAR_HPP
|
---|
122 |
|
---|
123 | #include <xercesc/util/RefHashTableOf.hpp>
|
---|
124 | #include <xercesc/util/NameIdPool.hpp>
|
---|
125 | #include <xercesc/util/StringPool.hpp>
|
---|
126 | #include <xercesc/validators/common/Grammar.hpp>
|
---|
127 | #include <xercesc/validators/DTD/DTDElementDecl.hpp>
|
---|
128 | #include <xercesc/validators/DTD/DTDEntityDecl.hpp>
|
---|
129 | #include <xercesc/framework/XMLDTDDescription.hpp>
|
---|
130 |
|
---|
131 |
|
---|
132 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
133 |
|
---|
134 | //
|
---|
135 | // This class stores the DTD information
|
---|
136 | // NOTE: DTDs are not namespace aware, so we just use regular NameIdPool
|
---|
137 | // data structures to store element and attribute decls. They are all set
|
---|
138 | // to be in the global namespace and the full QName is used as the base name
|
---|
139 | // of the decl. This means that all the URI parameters below are expected
|
---|
140 | // to be null pointers (and anything else will cause an exception.)
|
---|
141 | //
|
---|
142 |
|
---|
143 | class VALIDATORS_EXPORT DTDGrammar : public Grammar
|
---|
144 | {
|
---|
145 | public:
|
---|
146 | // -----------------------------------------------------------------------
|
---|
147 | // Constructors and Destructor
|
---|
148 | // -----------------------------------------------------------------------
|
---|
149 | DTDGrammar(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
150 | virtual ~DTDGrammar();
|
---|
151 |
|
---|
152 | // -----------------------------------------------------------------------
|
---|
153 | // Implementation of Virtual Interface
|
---|
154 | // -----------------------------------------------------------------------
|
---|
155 | virtual Grammar::GrammarType getGrammarType() const;
|
---|
156 | virtual const XMLCh* getTargetNamespace() const;
|
---|
157 |
|
---|
158 | // this method should only be used while the grammar is being
|
---|
159 | // constructed, not while it is being used
|
---|
160 | // in a validation episode!
|
---|
161 | virtual XMLElementDecl* findOrAddElemDecl
|
---|
162 | (
|
---|
163 | const unsigned int uriId
|
---|
164 | , const XMLCh* const baseName
|
---|
165 | , const XMLCh* const prefixName
|
---|
166 | , const XMLCh* const qName
|
---|
167 | , unsigned int scope
|
---|
168 | , bool& wasAdded
|
---|
169 | ) ;
|
---|
170 |
|
---|
171 | virtual unsigned int getElemId
|
---|
172 | (
|
---|
173 | const unsigned int uriId
|
---|
174 | , const XMLCh* const baseName
|
---|
175 | , const XMLCh* const qName
|
---|
176 | , unsigned int scope
|
---|
177 | ) const ;
|
---|
178 |
|
---|
179 | virtual const XMLElementDecl* getElemDecl
|
---|
180 | (
|
---|
181 | const unsigned int uriId
|
---|
182 | , const XMLCh* const baseName
|
---|
183 | , const XMLCh* const qName
|
---|
184 | , unsigned int scope
|
---|
185 | ) const ;
|
---|
186 |
|
---|
187 | virtual XMLElementDecl* getElemDecl
|
---|
188 | (
|
---|
189 | const unsigned int uriId
|
---|
190 | , const XMLCh* const baseName
|
---|
191 | , const XMLCh* const qName
|
---|
192 | , unsigned int scope
|
---|
193 | );
|
---|
194 |
|
---|
195 | virtual const XMLElementDecl* getElemDecl
|
---|
196 | (
|
---|
197 | const unsigned int elemId
|
---|
198 | ) const;
|
---|
199 |
|
---|
200 | virtual XMLElementDecl* getElemDecl
|
---|
201 | (
|
---|
202 | const unsigned int elemId
|
---|
203 | );
|
---|
204 |
|
---|
205 | virtual const XMLNotationDecl* getNotationDecl
|
---|
206 | (
|
---|
207 | const XMLCh* const notName
|
---|
208 | ) const;
|
---|
209 |
|
---|
210 | virtual XMLNotationDecl* getNotationDecl
|
---|
211 | (
|
---|
212 | const XMLCh* const notName
|
---|
213 | );
|
---|
214 |
|
---|
215 | virtual bool getValidated() const;
|
---|
216 |
|
---|
217 | virtual XMLElementDecl* putElemDecl
|
---|
218 | (
|
---|
219 | const unsigned int uriId
|
---|
220 | , const XMLCh* const baseName
|
---|
221 | , const XMLCh* const prefixName
|
---|
222 | , const XMLCh* const qName
|
---|
223 | , unsigned int scope
|
---|
224 | , const bool notDeclared = false
|
---|
225 | );
|
---|
226 |
|
---|
227 | virtual unsigned int putElemDecl
|
---|
228 | (
|
---|
229 | XMLElementDecl* const elemDecl
|
---|
230 | , const bool notDeclared = false
|
---|
231 | ) ;
|
---|
232 |
|
---|
233 | virtual unsigned int putNotationDecl
|
---|
234 | (
|
---|
235 | XMLNotationDecl* const notationDecl
|
---|
236 | ) const;
|
---|
237 |
|
---|
238 | virtual void setValidated(const bool newState);
|
---|
239 |
|
---|
240 | virtual void reset();
|
---|
241 |
|
---|
242 | // -----------------------------------------------------------------------
|
---|
243 | // Getter methods
|
---|
244 | // -----------------------------------------------------------------------
|
---|
245 |
|
---|
246 | // deprecated. returns the ID of the root element; not
|
---|
247 | // useable in multithreaded environments!
|
---|
248 | unsigned int getRootElemId() const;
|
---|
249 | const DTDEntityDecl* getEntityDecl(const XMLCh* const entName) const;
|
---|
250 | DTDEntityDecl* getEntityDecl(const XMLCh* const entName);
|
---|
251 | NameIdPool<DTDEntityDecl>* getEntityDeclPool();
|
---|
252 | const NameIdPool<DTDEntityDecl>* getEntityDeclPool() const;
|
---|
253 | NameIdPoolEnumerator<DTDElementDecl> getElemEnumerator() const;
|
---|
254 | NameIdPoolEnumerator<DTDEntityDecl> getEntityEnumerator() const;
|
---|
255 | NameIdPoolEnumerator<XMLNotationDecl> getNotationEnumerator() const;
|
---|
256 |
|
---|
257 | // -----------------------------------------------------------------------
|
---|
258 | // Setter methods
|
---|
259 | // -----------------------------------------------------------------------
|
---|
260 |
|
---|
261 | // deprecated. Not usable in multithreaded environments
|
---|
262 | void setRootElemId(unsigned int rootElemId);
|
---|
263 |
|
---|
264 | virtual void setGrammarDescription( XMLGrammarDescription*);
|
---|
265 | virtual XMLGrammarDescription* getGrammarDescription() const;
|
---|
266 |
|
---|
267 | // -----------------------------------------------------------------------
|
---|
268 | // Content management methods
|
---|
269 | // -----------------------------------------------------------------------
|
---|
270 | unsigned int putEntityDecl(DTDEntityDecl* const entityDecl) const;
|
---|
271 |
|
---|
272 |
|
---|
273 | // -----------------------------------------------------------------------
|
---|
274 | // Notification that lazy data has been deleted
|
---|
275 | // -----------------------------------------------------------------------
|
---|
276 | static void reinitDfltEntities();
|
---|
277 |
|
---|
278 | /***
|
---|
279 | * Support for Serialization/De-serialization
|
---|
280 | ***/
|
---|
281 | DECL_XSERIALIZABLE(DTDGrammar)
|
---|
282 |
|
---|
283 | private:
|
---|
284 | // -----------------------------------------------------------------------
|
---|
285 | // Private helper methods
|
---|
286 | // -----------------------------------------------------------------------
|
---|
287 | void resetEntityDeclPool();
|
---|
288 |
|
---|
289 | // -----------------------------------------------------------------------
|
---|
290 | // Unimplemented constructors and operators
|
---|
291 | // -----------------------------------------------------------------------
|
---|
292 | DTDGrammar(const DTDGrammar &);
|
---|
293 | DTDGrammar& operator = (const DTDGrammar&);
|
---|
294 |
|
---|
295 | // -----------------------------------------------------------------------
|
---|
296 | // Private data members
|
---|
297 | //
|
---|
298 | // fElemDeclPool
|
---|
299 | // This is the element decl pool. It contains all of the elements
|
---|
300 | // declared in the DTD (and their associated attributes.)
|
---|
301 | //
|
---|
302 | // fElemNonDeclPool
|
---|
303 | // This is the element decl pool that is is populated as new elements
|
---|
304 | // are seen in the XML document (not declared in the DTD), and they
|
---|
305 | // are given default characteristics.
|
---|
306 | //
|
---|
307 | // fEntityDeclPool
|
---|
308 | // This is a pool of EntityDecl objects, which contains all of the
|
---|
309 | // general entities that are declared in the DTD subsets, plus the
|
---|
310 | // default entities (such as > < ...) defined by the XML Standard.
|
---|
311 | //
|
---|
312 | // fNotationDeclPool
|
---|
313 | // This is a pool of NotationDecl objects, which contains all of the
|
---|
314 | // notations declared in the DTD subsets.
|
---|
315 | //
|
---|
316 | // fRootElemId
|
---|
317 | // The id of the root element that we found in the DOCTYPE statement.
|
---|
318 | // Its initialized to ContentModel::fgInvalidElemId, so that its
|
---|
319 | // invalid unless we have a DOCTYPE.
|
---|
320 | //
|
---|
321 | // fValidated
|
---|
322 | // Indicates if the content of the Grammar has been pre-validated
|
---|
323 | // or not. When using a cached grammar, no need for pre content
|
---|
324 | // validation.
|
---|
325 | //
|
---|
326 | // fGramDesc: adopted
|
---|
327 | //
|
---|
328 | // -----------------------------------------------------------------------
|
---|
329 | static NameIdPool<DTDEntityDecl>* fDefaultEntities;
|
---|
330 | MemoryManager* fMemoryManager;
|
---|
331 | NameIdPool<DTDElementDecl>* fElemDeclPool;
|
---|
332 | NameIdPool<DTDElementDecl>* fElemNonDeclPool;
|
---|
333 | NameIdPool<DTDEntityDecl>* fEntityDeclPool;
|
---|
334 | NameIdPool<XMLNotationDecl>* fNotationDeclPool;
|
---|
335 | unsigned int fRootElemId;
|
---|
336 | bool fValidated;
|
---|
337 | XMLDTDDescription* fGramDesc;
|
---|
338 | };
|
---|
339 |
|
---|
340 |
|
---|
341 | // ---------------------------------------------------------------------------
|
---|
342 | // DTDGrammar: Getter methods
|
---|
343 | // ---------------------------------------------------------------------------
|
---|
344 | inline unsigned int DTDGrammar::getRootElemId() const
|
---|
345 | {
|
---|
346 | return fRootElemId;
|
---|
347 | }
|
---|
348 |
|
---|
349 | // ---------------------------------------------------------------------------
|
---|
350 | // DTDGrammar: Getter methods
|
---|
351 | // ---------------------------------------------------------------------------
|
---|
352 | inline NameIdPoolEnumerator<DTDElementDecl>
|
---|
353 | DTDGrammar::getElemEnumerator() const
|
---|
354 | {
|
---|
355 | return NameIdPoolEnumerator<DTDElementDecl>(fElemDeclPool, fMemoryManager);
|
---|
356 | }
|
---|
357 |
|
---|
358 | inline NameIdPoolEnumerator<DTDEntityDecl>
|
---|
359 | DTDGrammar::getEntityEnumerator() const
|
---|
360 | {
|
---|
361 | return NameIdPoolEnumerator<DTDEntityDecl>(fEntityDeclPool, fMemoryManager);
|
---|
362 | }
|
---|
363 |
|
---|
364 | inline NameIdPoolEnumerator<XMLNotationDecl>
|
---|
365 | DTDGrammar::getNotationEnumerator() const
|
---|
366 | {
|
---|
367 | return NameIdPoolEnumerator<XMLNotationDecl>(fNotationDeclPool, fMemoryManager);
|
---|
368 | }
|
---|
369 |
|
---|
370 | inline const DTDEntityDecl*
|
---|
371 | DTDGrammar::getEntityDecl(const XMLCh* const entName) const
|
---|
372 | {
|
---|
373 | DTDEntityDecl* decl = fDefaultEntities->getByKey(entName);
|
---|
374 |
|
---|
375 | if (!decl)
|
---|
376 | return fEntityDeclPool->getByKey(entName);
|
---|
377 |
|
---|
378 | return decl;
|
---|
379 | }
|
---|
380 |
|
---|
381 | inline DTDEntityDecl* DTDGrammar::getEntityDecl(const XMLCh* const entName)
|
---|
382 | {
|
---|
383 | DTDEntityDecl* decl = fDefaultEntities->getByKey(entName);
|
---|
384 |
|
---|
385 | if (!decl)
|
---|
386 | return fEntityDeclPool->getByKey(entName);
|
---|
387 |
|
---|
388 | return decl;
|
---|
389 | }
|
---|
390 |
|
---|
391 |
|
---|
392 | inline NameIdPool<DTDEntityDecl>* DTDGrammar::getEntityDeclPool()
|
---|
393 | {
|
---|
394 | return fEntityDeclPool;
|
---|
395 | }
|
---|
396 |
|
---|
397 | inline const NameIdPool<DTDEntityDecl>* DTDGrammar::getEntityDeclPool() const
|
---|
398 | {
|
---|
399 | return fEntityDeclPool;
|
---|
400 | }
|
---|
401 |
|
---|
402 | // -----------------------------------------------------------------------
|
---|
403 | // Setter methods
|
---|
404 | // -----------------------------------------------------------------------
|
---|
405 | inline void DTDGrammar::setRootElemId(unsigned int rootElemId) {
|
---|
406 | fRootElemId = rootElemId;
|
---|
407 | }
|
---|
408 |
|
---|
409 | inline unsigned int DTDGrammar::putEntityDecl(DTDEntityDecl* const entityDecl) const
|
---|
410 | {
|
---|
411 | return fEntityDeclPool->put(entityDecl);
|
---|
412 | }
|
---|
413 |
|
---|
414 |
|
---|
415 | // ---------------------------------------------------------------------------
|
---|
416 | // DTDGrammar: Virtual methods
|
---|
417 | // ---------------------------------------------------------------------------
|
---|
418 | inline Grammar::GrammarType DTDGrammar::getGrammarType() const {
|
---|
419 | return Grammar::DTDGrammarType;
|
---|
420 | }
|
---|
421 |
|
---|
422 | inline const XMLCh* DTDGrammar::getTargetNamespace() const {
|
---|
423 | return XMLUni::fgZeroLenString;
|
---|
424 | }
|
---|
425 |
|
---|
426 | // Element Decl
|
---|
427 | inline unsigned int DTDGrammar::getElemId (const unsigned int
|
---|
428 | , const XMLCh* const
|
---|
429 | , const XMLCh* const qName
|
---|
430 | , unsigned int) const
|
---|
431 | {
|
---|
432 | //
|
---|
433 | // In this case, we don't return zero to mean 'not found', so we have to
|
---|
434 | // map it to the official not found value if we don't find it.
|
---|
435 | //
|
---|
436 | const DTDElementDecl* decl = fElemDeclPool->getByKey(qName);
|
---|
437 | if (!decl)
|
---|
438 | return XMLElementDecl::fgInvalidElemId;
|
---|
439 | return decl->getId();
|
---|
440 | }
|
---|
441 |
|
---|
442 | inline const XMLElementDecl* DTDGrammar::getElemDecl( const unsigned int
|
---|
443 | , const XMLCh* const
|
---|
444 | , const XMLCh* const qName
|
---|
445 | , unsigned int) const
|
---|
446 | {
|
---|
447 | const XMLElementDecl* elemDecl = fElemDeclPool->getByKey(qName);
|
---|
448 |
|
---|
449 | if (!elemDecl && fElemNonDeclPool)
|
---|
450 | elemDecl = fElemNonDeclPool->getByKey(qName);
|
---|
451 |
|
---|
452 | return elemDecl;
|
---|
453 | }
|
---|
454 |
|
---|
455 | inline XMLElementDecl* DTDGrammar::getElemDecl (const unsigned int
|
---|
456 | , const XMLCh* const
|
---|
457 | , const XMLCh* const qName
|
---|
458 | , unsigned int)
|
---|
459 | {
|
---|
460 | XMLElementDecl* elemDecl = fElemDeclPool->getByKey(qName);
|
---|
461 |
|
---|
462 | if (!elemDecl && fElemNonDeclPool)
|
---|
463 | elemDecl = fElemNonDeclPool->getByKey(qName);
|
---|
464 |
|
---|
465 | return elemDecl;
|
---|
466 | }
|
---|
467 |
|
---|
468 | inline const XMLElementDecl* DTDGrammar::getElemDecl(const unsigned int elemId) const
|
---|
469 | {
|
---|
470 | // Look up this element decl by id
|
---|
471 | return fElemDeclPool->getById(elemId);
|
---|
472 | }
|
---|
473 |
|
---|
474 | inline XMLElementDecl* DTDGrammar::getElemDecl(const unsigned int elemId)
|
---|
475 | {
|
---|
476 | // Look up this element decl by id
|
---|
477 | return fElemDeclPool->getById(elemId);
|
---|
478 | }
|
---|
479 |
|
---|
480 | inline unsigned int
|
---|
481 | DTDGrammar::putElemDecl(XMLElementDecl* const elemDecl,
|
---|
482 | const bool notDeclared)
|
---|
483 | {
|
---|
484 | if (notDeclared)
|
---|
485 | {
|
---|
486 | if(!fElemNonDeclPool)
|
---|
487 | fElemNonDeclPool = new (fMemoryManager) NameIdPool<DTDElementDecl>(29, 128, fMemoryManager);
|
---|
488 | return fElemNonDeclPool->put((DTDElementDecl*) elemDecl);
|
---|
489 | }
|
---|
490 |
|
---|
491 | return fElemDeclPool->put((DTDElementDecl*) elemDecl);
|
---|
492 | }
|
---|
493 |
|
---|
494 | // Notation Decl
|
---|
495 | inline const XMLNotationDecl* DTDGrammar::getNotationDecl(const XMLCh* const notName) const
|
---|
496 | {
|
---|
497 | return fNotationDeclPool->getByKey(notName);
|
---|
498 | }
|
---|
499 |
|
---|
500 | inline XMLNotationDecl* DTDGrammar::getNotationDecl(const XMLCh* const notName)
|
---|
501 | {
|
---|
502 | return fNotationDeclPool->getByKey(notName);
|
---|
503 | }
|
---|
504 |
|
---|
505 | inline unsigned int DTDGrammar::putNotationDecl(XMLNotationDecl* const notationDecl) const
|
---|
506 | {
|
---|
507 | return fNotationDeclPool->put(notationDecl);
|
---|
508 | }
|
---|
509 |
|
---|
510 | inline bool DTDGrammar::getValidated() const
|
---|
511 | {
|
---|
512 | return fValidated;
|
---|
513 | }
|
---|
514 |
|
---|
515 | inline void DTDGrammar::setValidated(const bool newState)
|
---|
516 | {
|
---|
517 | fValidated = newState;
|
---|
518 | }
|
---|
519 |
|
---|
520 | XERCES_CPP_NAMESPACE_END
|
---|
521 |
|
---|
522 | #endif
|
---|