source: NonGTP/Xerces/xercesc/parsers/SAXParser.hpp @ 188

Revision 188, 84.2 KB checked in by mattausch, 19 years ago (diff)

added xercesc to support

Line 
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: SAXParser.hpp,v $
59 * Revision 1.28  2003/12/01 23:23:26  neilg
60 * fix for bug 25118; thanks to Jeroen Witmond
61 *
62 * Revision 1.27  2003/11/06 15:30:07  neilg
63 * 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.
64 *
65 * Revision 1.26  2003/10/30 21:37:31  knoaman
66 * Enhanced Entity Resolver Support. Thanks to David Cargill.
67 *
68 * Revision 1.25  2003/10/20 13:41:10  amassari
69 * Added getGrammarResolver API
70 *
71 * Revision 1.24  2003/06/20 18:55:54  peiyongz
72 * Stateless Grammar Pool :: Part I
73 *
74 * Revision 1.23  2003/05/15 18:26:50  knoaman
75 * Partial implementation of the configurable memory manager.
76 *
77 * Revision 1.22  2003/04/17 21:58:50  neilg
78 * Adding a new property,
79 * http://apache.org/xml/properties/security-manager, with
80 * appropriate getSecurityManager/setSecurityManager methods on DOM
81 * and SAX parsers.  Also adding a new SecurityManager class.
82 *
83 * The purpose of these modifications is to permit applications a
84 * means to have the parser reject documents whose processing would
85 * otherwise consume large amounts of system resources.  Malicious
86 * use of such documents could be used to launch a denial-of-service
87 * attack against a system running the parser.  Initially, the
88 * SecurityManager only knows about attacks that can result from
89 * exponential entity expansion; this is the only known attack that
90 * involves processing a single XML document.  Other, simlar attacks
91 * can be launched if arbitrary schemas may be parsed; there already
92 * exist means (via use of the EntityResolver interface) by which
93 * applications can deny processing of untrusted schemas.  In future,
94 * the SecurityManager will be expanded to take these other exploits
95 * into account.
96 *
97 * Add support for the SecurityManager
98 *
99 * Revision 1.21  2003/03/07 18:09:17  tng
100 * Return a reference instead of void for operator=
101 *
102 * Revision 1.20  2003/02/04 19:27:43  knoaman
103 * Performance: use global buffer to eliminate repetitive memory creation/deletion.
104 *
105 * Revision 1.19  2003/01/09 19:07:08  tng
106 * [Bug 15802] Add "const" qualifier to getURIText.
107 *
108 * Revision 1.18  2003/01/03 20:09:36  tng
109 * New feature StandardUriConformant to force strict standard uri conformance.
110 *
111 * Revision 1.17  2002/12/30 20:15:51  knoaman
112 * Make calculate src offset option false by default.
113 *
114 * Revision 1.16  2002/12/23 15:23:18  knoaman
115 * Added a public api to various parsers to return the src offset within the input
116 * source.
117 *
118 * Revision 1.15  2002/12/04 01:57:09  knoaman
119 * Scanner re-organization.
120 *
121 * Revision 1.14  2002/11/04 14:57:03  tng
122 * C++ Namespace Support.
123 *
124 * Revision 1.13  2002/08/14 15:20:38  knoaman
125 * [Bug 3111] Problem with LexicalHandler::startDTD() and LexicalHandler::endDTD().
126 *
127 * Revision 1.12  2002/07/11 18:27:03  knoaman
128 * Grammar caching/preparsing - initial implementation.
129 *
130 * Revision 1.11  2002/06/27 18:48:04  tng
131 * API Documentation Update and move getScanner as protected
132 *
133 * Revision 1.10  2002/06/17 15:41:44  tng
134 * Update API Documentation
135 *
136 * Revision 1.9  2002/06/06 20:38:18  tng
137 * Document Fix: document that the returned object from resolveEntity is owned by the parser
138 *
139 * Revision 1.8  2002/05/31 15:13:53  tng
140 * Fix doxygen documentation.
141 *
142 * Revision 1.7  2002/05/30 16:39:06  knoaman
143 * DOM L3 LS.
144 *
145 * Revision 1.6  2002/05/30 16:20:09  tng
146 * Add feature to optionally ignore external DTD.
147 *
148 * Revision 1.5  2002/05/29 21:37:47  knoaman
149 * Add baseURI to resolveEntity to support DOMInputSource.
150 *
151 * Revision 1.4  2002/05/28 20:44:14  tng
152 * [Bug 9104] prefixes dissapearing when schema validation turned on.
153 *
154 * Revision 1.3  2002/05/27 18:39:21  tng
155 * To get ready for 64 bit large file, use XMLSSize_t to represent line and column number.
156 *
157 * Revision 1.2  2002/02/20 18:17:01  tng
158 * [Bug 5977] Warnings on generating apiDocs.
159 *
160 * Revision 1.1.1.1  2002/02/01 22:22:07  peiyongz
161 * sane_include
162 *
163 * Revision 1.22  2001/12/05 22:09:02  tng
164 * Update documentation for setExternalSchemaLocation and setExternalNoNamespaceSchemaLocation.
165 *
166 * Revision 1.21  2001/11/20 18:51:44  tng
167 * Schema: schemaLocation and noNamespaceSchemaLocation to be specified outside the instance document.  New methods setExternalSchemaLocation and setExternalNoNamespaceSchemaLocation are added (for SAX2, two new properties are added).
168 *
169 * Revision 1.20  2001/08/01 19:11:02  tng
170 * Add full schema constraint checking flag to the samples and the parser.
171 *
172 * Revision 1.19  2001/07/27 20:24:21  tng
173 * put getScanner() back as they were there before, not to break existing apps.
174 *
175 * Revision 1.18  2001/07/16 12:52:09  tng
176 * APIDocs fix: default for schema processing in DOMParser, IDOMParser, and SAXParser should be false.
177 *
178 * Revision 1.17  2001/06/23 14:13:16  tng
179 * Remove getScanner from the Parser headers as this is not needed and Scanner is not internal class.
180 *
181 * Revision 1.16  2001/06/03 19:26:20  jberry
182 * Add support for querying error count following parse; enables simple parse without requiring error handler.
183 *
184 * Revision 1.15  2001/05/11 13:26:22  tng
185 * Copyright update.
186 *
187 * Revision 1.14  2001/05/03 19:09:25  knoaman
188 * Support Warning/Error/FatalError messaging.
189 * Validity constraints errors are treated as errors, with the ability by user to set
190 * validity constraints as fatal errors.
191 *
192 * Revision 1.13  2001/03/30 16:46:57  tng
193 * Schema: Use setDoSchema instead of setSchemaValidation which makes more sense.
194 *
195 * Revision 1.12  2001/03/21 21:56:09  tng
196 * Schema: Add Schema Grammar, Schema Validator, and split the DTDValidator into DTDValidator, DTDScanner, and DTDGrammar.
197 *
198 * Revision 1.11  2001/02/15 15:56:29  tng
199 * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
200 * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
201 * New data field  fSchemaValidation in XMLScanner as the flag.
202 *
203 * Revision 1.10  2001/01/12 21:23:41  tng
204 * Documentation Enhancement: explain values of Val_Scheme
205 *
206 * Revision 1.9  2000/08/02 18:05:15  jpolast
207 * changes required for sax2
208 * (changed private members to protected)
209 *
210 * Revision 1.8  2000/04/12 22:58:30  roddey
211 * Added support for 'auto validate' mode.
212 *
213 * Revision 1.7  2000/03/03 01:29:34  roddey
214 * Added a scanReset()/parseReset() method to the scanner and
215 * parsers, to allow for reset after early exit from a progressive parse.
216 * Added calls to new Terminate() call to all of the samples. Improved
217 * documentation in SAX and DOM parsers.
218 *
219 * Revision 1.6  2000/02/17 03:54:27  rahulj
220 * Added some new getters to query the parser state and
221 * clarified the documentation.
222 *
223 * Revision 1.5  2000/02/16 03:42:58  rahulj
224 * Finished documenting the SAX Driver implementation.
225 *
226 * Revision 1.4  2000/02/15 04:47:37  rahulj
227 * Documenting the SAXParser framework. Not done yet.
228 *
229 * Revision 1.3  2000/02/06 07:47:56  rahulj
230 * Year 2K copyright swat.
231 *
232 * Revision 1.2  1999/12/15 19:57:48  roddey
233 * Got rid of redundant 'const' on boolean return value. Some compilers choke
234 * on this and its useless.
235 *
236 * Revision 1.1.1.1  1999/11/09 01:07:51  twl
237 * Initial checkin
238 *
239 * Revision 1.6  1999/11/08 20:44:54  rahul
240 * Swat for adding in Product name and CVS comment log variable.
241 *
242 */
243
244#if !defined(SAXPARSER_HPP)
245#define SAXPARSER_HPP
246
247#include <xercesc/sax/Parser.hpp>
248#include <xercesc/internal/VecAttrListImpl.hpp>
249#include <xercesc/framework/XMLDocumentHandler.hpp>
250#include <xercesc/framework/XMLElementDecl.hpp>
251#include <xercesc/framework/XMLEntityHandler.hpp>
252#include <xercesc/framework/XMLErrorReporter.hpp>
253#include <xercesc/framework/XMLBuffer.hpp>
254#include <xercesc/util/SecurityManager.hpp>
255#include <xercesc/validators/DTD/DocTypeHandler.hpp>
256
257XERCES_CPP_NAMESPACE_BEGIN
258
259
260class DocumentHandler;
261class EntityResolver;
262class XMLPScanToken;
263class XMLScanner;
264class XMLValidator;
265class Grammar;
266class GrammarResolver;
267class XMLGrammarPool;
268class XMLEntityResolver;
269class XMLResourceIdentifier;
270class PSVIHandler;
271
272/**
273  * This class implements the SAX 'Parser' interface and should be
274  * used by applications wishing to parse the XML files using SAX.
275  * It allows the client program to install SAX handlers for event
276  * callbacks.
277  *
278  * <p>It can be used to instantiate a validating or non-validating
279  * parser, by setting a member flag.</p>
280  */
281
282class PARSERS_EXPORT SAXParser :
283
284    public XMemory
285    , public Parser
286    , public XMLDocumentHandler
287    , public XMLErrorReporter
288    , public XMLEntityHandler
289    , public DocTypeHandler   
290{
291public :
292    // -----------------------------------------------------------------------
293    //  Class types
294    // -----------------------------------------------------------------------
295    /** ValScheme enum used in setValidationScheme
296      *    Val_Never:  Do not report validation errors.
297      *    Val_Always: The parser will always report validation errors.
298      *    Val_Auto:   The parser will report validation errors only if a grammar is specified.
299      *
300      * @see #setValidationScheme
301      */
302
303    enum ValSchemes
304    {
305        Val_Never
306        , Val_Always
307        , Val_Auto
308    };
309
310
311    // -----------------------------------------------------------------------
312    //  Constructors and Destructor
313    // -----------------------------------------------------------------------
314    /** @name Constructors and Destructor */
315    //@{
316    /** Constructor with an instance of validator class to use for
317      * validation.
318      * @param valToAdopt Pointer to the validator instance to use. The
319      *                   parser is responsible for freeing the memory.
320      * @param manager    Pointer to the memory manager to be used to
321      *                   allocate objects.
322      * @param gramPool   The collection of cached grammers.
323      */
324    SAXParser
325    (
326          XMLValidator*   const valToAdopt = 0
327        , MemoryManager*  const manager = XMLPlatformUtils::fgMemoryManager
328        , XMLGrammarPool* const gramPool = 0
329    );
330
331    /**
332      * Destructor
333      */
334    ~SAXParser();
335    //@}
336
337
338    // -----------------------------------------------------------------------
339    //  Getter Methods
340    // -----------------------------------------------------------------------
341    /** @name Getter methods */
342    //@{
343    /**
344      * This method returns the installed document handler. Suitable
345      * for 'lvalue' usages.
346      *
347      * @return The pointer to the installed document handler object.
348      */
349    DocumentHandler* getDocumentHandler();
350
351    /**
352      * This method returns the installed document handler. Suitable
353      * only for 'rvalue' usages.
354      *
355      * @return A const pointer to the installed document handler object.
356      */
357    const DocumentHandler* getDocumentHandler() const;
358
359    /**
360      * This method returns the installed entity resolver. Suitable
361      * for 'lvalue' usages.
362      *
363      * @return The pointer to the installed entity resolver object.
364      */
365    EntityResolver* getEntityResolver();
366
367    /**
368      * This method returns the installed entity resolver. Suitable
369      * for 'rvalue' usages.
370      *
371      * @return A const pointer to the installed entity resolver object.
372      */
373    const EntityResolver* getEntityResolver() const;
374
375    /**
376      * This method returns the installed entity resolver. Suitable
377      * for 'lvalue' usages.
378      *
379      * @return The pointer to the installed entity resolver object.
380      */
381    XMLEntityResolver* getXMLEntityResolver();
382
383    /**
384      * This method returns the installed entity resolver. Suitable
385      * for 'rvalue' usages.
386      *
387      * @return A const pointer to the installed entity resolver object.
388      */
389    const XMLEntityResolver* getXMLEntityResolver() const;
390
391    /**
392      * This method returns the installed error handler. Suitable
393      * for 'lvalue' usages.
394      *
395      * @return The pointer to the installed error handler object.
396      */
397    ErrorHandler* getErrorHandler();
398
399    /**
400      * This method returns the installed error handler. Suitable
401      * for 'rvalue' usages.
402      *
403      * @return A const pointer to the installed error handler object.
404      */
405    const ErrorHandler* getErrorHandler() const;
406
407    /**
408      * This method returns the installed PSVI handler. Suitable
409      * for 'lvalue' usages.
410      *
411      * @return The pointer to the installed PSVI handler object.
412      */
413    PSVIHandler* getPSVIHandler();
414
415    /**
416      * This method returns the installed PSVI handler. Suitable
417      * for 'rvalue' usages.
418      *
419      * @return A const pointer to the installed PSVI handler object.
420      */
421    const PSVIHandler* getPSVIHandler() const;
422
423    /**
424      * This method returns a reference to the parser's installed
425      * validator.
426      *
427      * @return A const reference to the installed validator object.
428      */
429    const XMLValidator& getValidator() const;
430
431    /**
432      * This method returns an enumerated value that indicates the current
433      * validation scheme set on this parser.
434      *
435      * @return The ValSchemes value current set on this parser.
436      * @see #setValidationScheme
437      */
438    ValSchemes getValidationScheme() const;
439
440    /** Get the 'do schema' flag
441      *
442      * This method returns the state of the parser's schema processing
443      * flag.
444      *
445      * @return true, if the parser is currently configured to
446      *         understand schema, false otherwise.
447      *
448      * @see #setDoSchema
449      */
450    bool getDoSchema() const;
451
452    /** Get the 'full schema constraint checking' flag
453      *
454      * This method returns the state of the parser's full schema constraint
455      * checking flag.
456      *
457      * @return true, if the parser is currently configured to
458      *         have full schema constraint checking, false otherwise.
459      *
460      * @see #setValidationSchemaFullChecking
461      */
462    bool getValidationSchemaFullChecking() const;
463
464    /** Get error count from the last parse operation.
465      *
466      * This method returns the error count from the last parse
467      * operation. Note that this count is actually stored in the
468      * scanner, so this method simply returns what the
469      * scanner reports.
470      *
471      * @return number of errors encountered during the latest
472      *                 parse operation.
473      */
474    int getErrorCount() const;
475
476    /**
477      * This method returns the state of the parser's namespace
478      * handling capability.
479      *
480      * @return true, if the parser is currently configured to
481      *         understand namespaces, false otherwise.
482      *
483      * @see #setDoNamespaces
484      */
485    bool getDoNamespaces() const;
486
487    /**
488      * This method returns the state of the parser's
489      * exit-on-First-Fatal-Error flag.
490      *
491      * @return true, if the parser is currently configured to
492      *         exit on the first fatal error, false otherwise.
493      *
494      * @see #setExitOnFirstFatalError
495      */
496    bool getExitOnFirstFatalError() const;
497
498    /**
499      * This method returns the state of the parser's
500      * validation-constraint-fatal flag.
501      *
502      * @return true, if the parser is currently configured to
503      *         set validation constraint errors as fatal, false
504      *         otherwise.
505      *
506      * @see #setValidationContraintFatal
507      */
508    bool getValidationConstraintFatal() const;
509
510   /** Get the set of Namespace/SchemaLocation that is specified externaly.
511      *
512      * This method returns the list of Namespace/SchemaLocation that was
513      * specified using setExternalSchemaLocation.
514      *
515      * The parser owns the returned string, and the memory allocated for
516      * the returned string will be destroyed when the parser is deleted.
517      *
518      * To ensure assessiblity of the returned information after the parser
519      * is deleted, callers need to copy and store the returned information
520      * somewhere else.
521      *
522      * @return a pointer to the list of Namespace/SchemaLocation that was
523      *         specified externally.  The pointer spans the same life-time as
524      *         the parser.  A null pointer is returned if nothing
525      *         was specified externally.
526      *
527      * @see #setExternalSchemaLocation(const XMLCh* const)
528      */
529    XMLCh* getExternalSchemaLocation() const;
530
531   /** Get the noNamespace SchemaLocation that is specified externaly.
532      *
533      * This method returns the no target namespace XML Schema Location
534      * that was specified using setExternalNoNamespaceSchemaLocation.
535      *
536      * The parser owns the returned string, and the memory allocated for
537      * the returned string will be destroyed when the parser is deleted.
538      *
539      * To ensure assessiblity of the returned information after the parser
540      * is deleted, callers need to copy and store the returned information
541      * somewhere else.
542      *
543      * @return a pointer to the no target namespace Schema Location that was
544      *         specified externally.  The pointer spans the same life-time as
545      *         the parser.  A null pointer is returned if nothing
546      *         was specified externally.
547      *
548      * @see #setExternalNoNamespaceSchemaLocation(const XMLCh* const)
549      */
550    XMLCh* getExternalNoNamespaceSchemaLocation() const;
551
552   /** Get the SecurityManager instance attached to this parser.
553      *
554      * This method returns the security manager
555      * that was specified using setSecurityManager.
556      *
557      * The SecurityManager instance must have been specified by the application;
558      * this should not be deleted until after the parser has been deleted (or
559      * a new SecurityManager instance has been supplied to the parser).
560      *
561      * @return a pointer to the SecurityManager instance
562      *         specified externally.  A null pointer is returned if nothing
563      *         was specified externally.
564      *
565      * @see #setSecurityManager(const SecurityManager* const)
566      */
567    SecurityManager* getSecurityManager() const;
568
569    /** Get the 'Loading External DTD' flag
570      *
571      * This method returns the state of the parser's loading external DTD
572      * flag.
573      *
574      * @return false, if the parser is currently configured to
575      *         ignore external DTD completely, true otherwise.
576      *
577      * @see #setLoadExternalDTD
578      * @see #getValidationScheme
579      */
580    bool getLoadExternalDTD() const;
581
582    /** Get the 'Grammar caching' flag
583      *
584      * This method returns the state of the parser's grammar caching when
585      * parsing an XML document.
586      *
587      * @return true, if the parser is currently configured to
588      *         cache grammars, false otherwise.
589      *
590      * @see #cacheGrammarFromParse
591      */
592    bool isCachingGrammarFromParse() const;
593
594    /** Get the 'Use cached grammar' flag
595      *
596      * This method returns the state of the parser's use of cached grammar
597      * when parsing an XML document.
598      *
599      * @return true, if the parser is currently configured to
600      *         use cached grammars, false otherwise.
601      *
602      * @see #useCachedGrammarInParse
603      */
604    bool isUsingCachedGrammarInParse() const;
605
606    /**
607      * Get the 'calculate src offset flag'
608      *
609      * This method returns the state of the parser's src offset calculation
610      * when parsing an XML document.
611      *
612      * @return true, if the parser is currently configured to
613      *         calculate src offsets, false otherwise.
614      *
615      * @see #setCalculateSrcOfs
616      */
617    bool getCalculateSrcOfs() const;
618
619    /**
620      * Get the 'force standard uri flag'
621      *
622      * This method returns the state if the parser forces standard uri
623      *
624      * @return true, if the parser is currently configured to
625      *         force standard uri, i.e. malformed uri will be rejected.
626      *
627      * @see #setStandardUriConformant
628      */
629    bool getStandardUriConformant() const;
630
631    /**
632     * Retrieve the grammar that is associated with the specified namespace key
633     *
634     * @param  nameSpaceKey Namespace key
635     * @return Grammar associated with the Namespace key.
636     */
637    Grammar* getGrammar(const XMLCh* const nameSpaceKey);
638
639    /**
640     * Retrieve the grammar where the root element is declared.
641     *
642     * @return Grammar where root element declared
643     */
644    Grammar* getRootGrammar();
645
646    /**
647     * Returns the string corresponding to a URI id from the URI string pool.
648     *
649     * @param uriId id of the string in the URI string pool.
650     * @return URI string corresponding to the URI id.
651     */
652    const XMLCh* getURIText(unsigned int uriId) const;
653
654    /**
655     * Returns the current src offset within the input source.
656     *
657     * @return offset within the input source
658     */
659    unsigned int getSrcOffset() const;
660
661    //@}
662
663
664    // -----------------------------------------------------------------------
665    //  Setter methods
666    // -----------------------------------------------------------------------
667
668    /** @name Setter methods */
669    //@{
670    /**
671      * This method allows users to enable or disable the parser's
672      * namespace processing. When set to true, parser starts enforcing
673      * all the constraints / rules specified by the NameSpace
674      * specification.
675      *
676      * <p>The parser's default state is: false.</p>
677      *
678      * @param newState The value specifying whether NameSpace rules should
679      *                 be enforced or not.
680      *
681      * @see #getDoNamespaces
682      */
683    void setDoNamespaces(const bool newState);
684
685    /**
686      * This method allows users to set the validation scheme to be used
687      * by this parser. The value is one of the ValSchemes enumerated values
688      * defined by this class:
689      *
690      * <br>  Val_Never  - turn off validation
691      * <br>  Val_Always - turn on validation
692      * <br>  Val_Auto   - turn on validation if any internal/external
693      *                  DTD subset have been seen
694      *
695      * <p>The parser's default state is: Val_Auto.</p>
696      *
697      * @param newScheme The new validation scheme to use.
698      *
699      * @see #getValidationScheme
700      */
701    void setValidationScheme(const ValSchemes newScheme);
702
703    /** Set the 'schema support' flag
704      *
705      * This method allows users to enable or disable the parser's
706      * schema processing. When set to false, parser will not process
707      * any schema found.
708      *
709      * The parser's default state is: false.
710      *
711      * Note: If set to true, namespace processing must also be turned on.
712      *
713      * @param newState The value specifying whether schema support should
714      *                 be enforced or not.
715      *
716      * @see #getDoSchema
717      */
718    void setDoSchema(const bool newState);
719
720    /**
721      * This method allows the user to turn full Schema constraint checking on/off.
722      * Only takes effect if Schema validation is enabled.
723      * If turned off, partial constraint checking is done.
724      *
725      * Full schema constraint checking includes those checking that may
726      * be time-consuming or memory intensive. Currently, particle unique
727      * attribution constraint checking and particle derivation resriction checking
728      * are controlled by this option.
729      *
730      * The parser's default state is: false.
731      *
732      * @param schemaFullChecking True to turn on full schema constraint checking.
733      *
734      * @see #getValidationSchemaFullChecking
735      */
736    void setValidationSchemaFullChecking(const bool schemaFullChecking);
737
738    /**
739      * This method allows users to set the parser's behaviour when it
740      * encounters the first fatal error. If set to true, the parser
741      * will exit at the first fatal error. If false, then it will
742      * report the error and continue processing.
743      *
744      * <p>The default value is 'true' and the parser exits on the
745      * first fatal error.</p>
746      *
747      * @param newState The value specifying whether the parser should
748      *                 continue or exit when it encounters the first
749      *                 fatal error.
750      *
751      * @see #getExitOnFirstFatalError
752      */
753    void setExitOnFirstFatalError(const bool newState);
754
755    /**
756      * This method allows users to set the parser's behaviour when it
757      * encounters a validtion constraint error. If set to true, and the
758      * the parser will treat validation error as fatal and will exit depends on the
759      * state of "getExitOnFirstFatalError". If false, then it will
760      * report the error and continue processing.
761      *
762      * Note: setting this true does not mean the validation error will be printed with
763      * the word "Fatal Error".   It is still printed as "Error", but the parser
764      * will exit if "setExitOnFirstFatalError" is set to true.
765      *
766      * <p>The default value is 'false'.</p>
767      *
768      * @param newState If true, the parser will exit if "setExitOnFirstFatalError"
769      *                 is set to true.
770      *
771      * @see #getValidationConstraintFatal
772      * @see #setExitOnFirstFatalError
773      */
774    void setValidationConstraintFatal(const bool newState);
775
776    /**
777      * This method allows the user to specify a list of schemas to use.
778      * If the targetNamespace of a schema specified using this method matches
779      * the targetNamespace of a schema occuring in the instance document in
780      * the schemaLocation attribute, or if the targetNamespace matches the
781      * namespace attribute of the "import" element, the schema specified by the
782      * user using this method will be used (i.e., the schemaLocation attribute
783      * in the instance document or on the "import" element will be effectively ignored).
784      *
785      * If this method is called more than once, only the last one takes effect.
786      *
787      * The syntax is the same as for schemaLocation attributes in instance
788      * documents: e.g, "http://www.example.com file_name.xsd". The user can
789      * specify more than one XML Schema in the list.
790      *
791      * @param schemaLocation the list of schemas to use
792      *
793      * @see #getExternalSchemaLocation
794      */
795
796    void setExternalSchemaLocation(const XMLCh* const schemaLocation);
797
798    /**
799      * This method is same as setExternalSchemaLocation(const XMLCh* const).
800      * It takes native char string as parameter
801      *
802      * @param schemaLocation the list of schemas to use
803      *
804      * @see #setExternalSchemaLocation(const XMLCh* const)
805      */
806    void setExternalSchemaLocation(const char* const schemaLocation);
807
808    /**
809      * This method allows the user to specify the no target namespace XML
810      * Schema Location externally.  If specified, the instance document's
811      * noNamespaceSchemaLocation attribute will be effectively ignored.
812      *
813      * If this method is called more than once, only the last one takes effect.
814      *
815      * The syntax is the same as for the noNamespaceSchemaLocation attribute
816      * that may occur in an instance document: e.g."file_name.xsd".
817      *
818      * @param noNamespaceSchemaLocation the XML Schema Location with no target namespace
819      *
820      * @see #getExternalNoNamespaceSchemaLocation
821      */
822    void setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation);
823
824    /**
825      * This method is same as setExternalNoNamespaceSchemaLocation(const XMLCh* const).
826      * It takes native char string as parameter
827      *
828      * @param noNamespaceSchemaLocation the XML Schema Location with no target namespace
829      *
830      * @see #setExternalNoNamespaceSchemaLocation(const XMLCh* const)
831      */
832    void setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation);
833
834    /**
835      * This allows an application to set a SecurityManager on
836      * the parser; this object stores information that various
837      * components use to limit their consumption of system
838      * resources while processing documents.
839      *
840      * If this method is called more than once, only the last one takes effect.
841      * It may not be reset during a parse.
842      *
843      *
844      * @param securityManager  the SecurityManager instance to
845      * be used by this parser
846      *
847      * @see #getSecurityManager
848      */
849    void setSecurityManager(SecurityManager* const securityManager);
850
851    /** Set the 'Loading External DTD' flag
852      *
853      * This method allows users to enable or disable the loading of external DTD.
854      * When set to false, the parser will ignore any external DTD completely
855      * if the validationScheme is set to Val_Never.
856      *
857      * The parser's default state is: true.
858      *
859      * This flag is ignored if the validationScheme is set to Val_Always or Val_Auto.
860      *
861      * @param newState The value specifying whether external DTD should
862      *                 be loaded or not.
863      *
864      * @see #getLoadExternalDTD
865      * @see #setValidationScheme
866      */
867    void setLoadExternalDTD(const bool newState);
868
869    /** Set the 'Grammar caching' flag
870      *
871      * This method allows users to enable or disable caching of grammar when
872      * parsing XML documents. When set to true, the parser will cache the
873      * resulting grammar for use in subsequent parses.
874      *
875      * If the flag is set to true, the 'Use cached grammar' flag will also be
876      * set to true.
877      *
878      * The parser's default state is: false.
879      *
880      * @param newState The value specifying whether we should cache grammars
881      *                 or not.
882      *
883      * @see #isCachingGrammarFromParse
884      * @see #useCachedGrammarInParse
885      */
886    void cacheGrammarFromParse(const bool newState);
887
888    /** Set the 'Use cached grammar' flag
889      *
890      * This method allows users to enable or disable the use of cached
891      * grammars.  When set to true, the parser will use the cached grammar,
892      * instead of building the grammar from scratch, to validate XML
893      * documents.
894      *
895      * If the 'Grammar caching' flag is set to true, this mehod ignore the
896      * value passed in.
897      *
898      * The parser's default state is: false.
899      *
900      * @param newState The value specifying whether we should use the cached
901      *                 grammar or not.
902      *
903      * @see #isUsingCachedGrammarInParse
904      * @see #cacheGrammarFromParse
905      */
906    void useCachedGrammarInParse(const bool newState);
907
908    /** Enable/disable src offset calculation
909      *
910      * This method allows users to enable/disable src offset calculation.
911      * Disabling the calculation will improve performance.
912      *
913      * The parser's default state is: false.
914      *
915      * @param newState The value specifying whether we should enable or
916      *                 disable src offset calculation
917      *
918      * @see #getCalculateSrcOfs
919      */
920    void setCalculateSrcOfs(const bool newState);
921
922    /** Force standard uri
923      *
924      * This method allows users to tell the parser to force standard uri conformance.
925      *
926      * The parser's default state is: false.
927      *
928      * @param newState The value specifying whether the parser should reject malformed URI.
929      *
930      * @see #getStandardUriConformant
931      */
932    void setStandardUriConformant(const bool newState);
933
934    /** Set the scanner to use when scanning the XML document
935      *
936      * This method allows users to set the scanner to use
937      * when scanning a given XML document.
938      *
939      * @param scannerName The name of the desired scanner
940      */
941    void useScanner(const XMLCh* const scannerName);
942
943    //@}
944
945
946    // -----------------------------------------------------------------------
947    //  Advanced document handler list maintenance methods
948    // -----------------------------------------------------------------------
949
950    /** @name Advanced document handler list maintenance methods */
951    //@{
952    /**
953      * This method installs the specified 'advanced' document callback
954      * handler, thereby allowing the user to customize the processing,
955      * if they choose to do so. Any number of advanced callback handlers
956      * maybe installed.
957      *
958      * <p>The methods in the advanced callback interface represent
959      * Xerces-C extensions. There is no specification for this interface.</p>
960      *
961      * @param toInstall A pointer to the users advanced callback handler.
962      *
963      * @see #removeAdvDocHandler
964      */
965    void installAdvDocHandler(XMLDocumentHandler* const toInstall);
966
967    /**
968      * This method removes the 'advanced' document handler callback from
969      * the underlying parser scanner. If no handler is installed, advanced
970      * callbacks are not invoked by the scanner.
971      * @param toRemove A pointer to the advanced callback handler which
972      *                 should be removed.
973      *
974      * @see #installAdvDocHandler
975      */
976    bool removeAdvDocHandler(XMLDocumentHandler* const toRemove);
977    //@}
978
979
980    // -----------------------------------------------------------------------
981    //  Progressive scan methods
982    // -----------------------------------------------------------------------
983
984    /** @name Progressive scan methods */
985    //@{
986
987    /** Begin a progressive parse operation
988      *
989      * This method is used to start a progressive parse on a XML file.
990      * To continue parsing, subsequent calls must be to the parseNext
991      * method.
992      *
993      * It scans through the prolog and returns a token to be used on
994      * subsequent scanNext() calls. If the return value is true, then the
995      * token is legal and ready for further use. If it returns false, then
996      * the scan of the prolog failed and the token is not going to work on
997      * subsequent scanNext() calls.
998      *
999      * @param systemId A pointer to a Unicode string represting the path
1000      *                 to the XML file to be parsed.
1001      * @param toFill   A token maintaing state information to maintain
1002      *                 internal consistency between invocation of 'parseNext'
1003      *                 calls.
1004      *
1005      * @return 'true', if successful in parsing the prolog. It indicates the
1006      *         user can go ahead with parsing the rest of the file. It
1007      *         returns 'false' to indicate that the parser could parse the
1008      *         prolog (which means the token will not be valid.)
1009      *
1010      * @see #parseNext
1011      * @see #parseFirst(char*,...)
1012      * @see #parseFirst(InputSource&,...)
1013      */
1014    bool parseFirst
1015    (
1016        const   XMLCh* const    systemId
1017        ,       XMLPScanToken&  toFill
1018    );
1019
1020    /** Begin a progressive parse operation
1021      *
1022      * This method is used to start a progressive parse on a XML file.
1023      * To continue parsing, subsequent calls must be to the parseNext
1024      * method.
1025      *
1026      * It scans through the prolog and returns a token to be used on
1027      * subsequent scanNext() calls. If the return value is true, then the
1028      * token is legal and ready for further use. If it returns false, then
1029      * the scan of the prolog failed and the token is not going to work on
1030      * subsequent scanNext() calls.
1031      *
1032      * @param systemId A pointer to a regular native string represting
1033      *                 the path to the XML file to be parsed.
1034      * @param toFill   A token maintaing state information to maintain
1035      *                 internal consIstency between invocation of 'parseNext'
1036      *                 calls.
1037      *
1038      * @return 'true', if successful in parsing the prolog. It indicates the
1039      *         user can go ahead with parsing the rest of the file. It
1040      *         returns 'false' to indicate that the parser could not parse
1041      *         the prolog.
1042      *
1043      * @see #parseNext
1044      * @see #parseFirst(XMLCh*,...)
1045      * @see #parseFirst(InputSource&,...)
1046      */
1047    bool parseFirst
1048    (
1049        const   char* const     systemId
1050        ,       XMLPScanToken&  toFill
1051    );
1052
1053    /** Begin a progressive parse operation
1054      *
1055      * This method is used to start a progressive parse on a XML file.
1056      * To continue parsing, subsequent calls must be to the parseNext
1057      * method.
1058      *
1059      * It scans through the prolog and returns a token to be used on
1060      * subsequent scanNext() calls. If the return value is true, then the
1061      * token is legal and ready for further use. If it returns false, then
1062      * the scan of the prolog failed and the token is not going to work on
1063      * subsequent scanNext() calls.
1064      *
1065      * @param source   A const reference to the InputSource object which
1066      *                 points to the XML file to be parsed.
1067      * @param toFill   A token maintaing state information to maintain
1068      *                 internal consistency between invocation of 'parseNext'
1069      *                 calls.
1070      *
1071      * @return 'true', if successful in parsing the prolog. It indicates the
1072      *         user can go ahead with parsing the rest of the file. It
1073      *         returns 'false' to indicate that the parser could not parse
1074      *         the prolog.
1075      *
1076      * @see #parseNext
1077      * @see #parseFirst(XMLCh*,...)
1078      * @see #parseFirst(char*,...)
1079      */
1080    bool parseFirst
1081    (
1082        const   InputSource&    source
1083        ,       XMLPScanToken&  toFill
1084    );
1085
1086    /** Continue a progressive parse operation
1087      *
1088      * This method is used to continue with progressive parsing of
1089      * XML files started by a call to 'parseFirst' method.
1090      *
1091      * It parses the XML file and stops as soon as it comes across
1092      * a XML token (as defined in the XML specification). Relevant
1093      * callback handlers are invoked as required by the SAX
1094      * specification.
1095      *
1096      * @param token A token maintaing state information to maintain
1097      *              internal consistency between invocation of 'parseNext'
1098      *              calls.
1099      *
1100      * @return 'true', if successful in parsing the next XML token.
1101      *         It indicates the user can go ahead with parsing the rest
1102      *         of the file. It returns 'false' to indicate that the parser
1103      *         could not find next token as per the XML specification
1104      *         production rule.
1105      *
1106      * @see #parseFirst(XMLCh*,...)
1107      * @see #parseFirst(char*,...)
1108      * @see #parseFirst(InputSource&,...)
1109      */
1110    bool parseNext(XMLPScanToken& token);
1111
1112    /** Reset the parser after a progressive parse
1113      *
1114      * If a progressive parse loop exits before the end of the document
1115      * is reached, the parser has no way of knowing this. So it will leave
1116      * open any files or sockets or memory buffers that were in use at
1117      * the time that the parse loop exited.
1118      *
1119      * The next parse operation will cause these open files and such to
1120      * be closed, but the next parse operation might occur at some unknown
1121      * future point. To avoid this problem, you should reset the parser if
1122      * you exit the loop early.
1123      *
1124      * If you exited because of an error, then this cleanup will be done
1125      * for you. Its only when you exit the file prematurely of your own
1126      * accord, because you've found what you wanted in the file most
1127      * likely.
1128      *
1129      * @param token A token maintaing state information to maintain
1130      *              internal consistency between invocation of 'parseNext'
1131      *              calls.
1132      */
1133    void parseReset(XMLPScanToken& token);
1134
1135    //@}
1136
1137    // -----------------------------------------------------------------------
1138    //  Grammar preparsing interface
1139    // -----------------------------------------------------------------------
1140
1141    /** @name Implementation of Grammar preparsing interface's. */
1142    //@{
1143    /**
1144      * Preparse schema grammar (XML Schema, DTD, etc.) via an input source
1145      * object.
1146      *
1147      * This method invokes the preparsing process on a schema grammar XML
1148      * file specified by the SAX InputSource parameter. If the 'toCache' flag
1149      * is enabled, the parser will cache the grammars for re-use. If a grammar
1150      * key is found in the pool, no caching of any grammar will take place.
1151      *
1152      * <p><b>"Experimental - subject to change"</b></p>
1153      *
1154      * @param source A const reference to the SAX InputSource object which
1155      *               points to the schema grammar file to be preparsed.
1156      * @param grammarType The grammar type (Schema or DTD).
1157      * @param toCache If <code>true</code>, we cache the preparsed grammar,
1158      *                otherwise, no chaching. Default is <code>false</code>.
1159      * @return The preparsed schema grammar object (SchemaGrammar or
1160      *         DTDGrammar). That grammar object is owned by the parser.
1161      *
1162      * @exception SAXException Any SAX exception, possibly
1163      *            wrapping another exception.
1164      * @exception XMLException An exception from the parser or client
1165      *            handler code.
1166      * @exception DOMException A DOM exception as per DOM spec.
1167      *
1168      * @see InputSource#InputSource
1169      */
1170    Grammar* loadGrammar(const InputSource& source,
1171                         const short grammarType,
1172                         const bool toCache = false);
1173
1174    /**
1175      * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL
1176      *
1177      * This method invokes the preparsing process on a schema grammar XML
1178      * file specified by the file path parameter. If the 'toCache' flag
1179      * is enabled, the parser will cache the grammars for re-use. If a grammar
1180      * key is found in the pool, no caching of any grammar will take place.
1181      *
1182      * <p><b>"Experimental - subject to change"</b></p>
1183      *
1184      * @param systemId A const XMLCh pointer to the Unicode string which
1185      *                 contains the path to the XML grammar file to be
1186      *                 preparsed.
1187      * @param grammarType The grammar type (Schema or DTD).
1188      * @param toCache If <code>true</code>, we cache the preparsed grammar,
1189      *                otherwise, no chaching. Default is <code>false</code>.
1190      * @return The preparsed schema grammar object (SchemaGrammar or
1191      *         DTDGrammar). That grammar object is owned by the parser.
1192      *
1193      * @exception SAXException Any SAX exception, possibly
1194      *            wrapping another exception.
1195      * @exception XMLException An exception from the parser or client
1196      *            handler code.
1197      * @exception DOMException A DOM exception as per DOM spec.
1198      */
1199    Grammar* loadGrammar(const XMLCh* const systemId,
1200                         const short grammarType,
1201                         const bool toCache = false);
1202
1203    /**
1204      * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL
1205      *
1206      * This method invokes the preparsing process on a schema grammar XML
1207      * file specified by the file path parameter. If the 'toCache' flag
1208      * is enabled, the parser will cache the grammars for re-use. If a grammar
1209      * key is found in the pool, no caching of any grammar will take place.
1210      *
1211      * <p><b>"Experimental - subject to change"</b></p>
1212      *
1213      * @param systemId A const char pointer to a native string which contains
1214      *                 the path to the XML grammar file to be preparsed.
1215      * @param grammarType The grammar type (Schema or DTD).
1216      * @param toCache If <code>true</code>, we cache the preparsed grammar,
1217      *                otherwise, no chaching. Default is <code>false</code>.
1218      * @return The preparsed schema grammar object (SchemaGrammar or
1219      *         DTDGrammar). That grammar object is owned by the parser.
1220      *
1221      * @exception SAXException Any SAX exception, possibly
1222      *            wrapping another exception.
1223      * @exception XMLException An exception from the parser or client
1224      *            handler code.
1225      * @exception DOMException A DOM exception as per DOM spec.
1226      */
1227    Grammar* loadGrammar(const char* const systemId,
1228                         const short grammarType,
1229                         const bool toCache = false);
1230
1231    /**
1232      * This method allows the user to reset the pool of cached grammars.
1233      */
1234    void resetCachedGrammarPool();
1235
1236    //@}
1237
1238
1239    // -----------------------------------------------------------------------
1240    //  Implementation of the SAX Parser interface
1241    // -----------------------------------------------------------------------
1242
1243    /** @name Implementation of SAX 1.0 Parser interface's. */
1244    //@{
1245    /**
1246      * This method invokes the parsing process on the XML file specified
1247      * by the InputSource parameter.
1248      *
1249      * @param source A const reference to the InputSource object which
1250      *               points to the XML file to be parsed.
1251      *
1252      * @see Parser#parse(InputSource)
1253      */
1254    virtual void parse(const InputSource& source);
1255
1256    /**
1257      * This method invokes the parsing process on the XML file specified by
1258      * the Unicode string parameter 'systemId'.
1259      *
1260      * @param systemId A const XMLCh pointer to the Unicode string which
1261      *                 contains the path to the XML file to be parsed.
1262      *
1263      * @see Parser#parse(XMLCh*)
1264      */
1265    virtual void parse(const XMLCh* const systemId);
1266
1267    /**
1268      * This method invokes the parsing process on the XML file specified by
1269      * the native char* string parameter 'systemId'.
1270      *
1271      * @param systemId A const char pointer to a native string which
1272      *                 contains the path to the XML file to be parsed.
1273      */
1274    virtual void parse(const char* const systemId);
1275
1276    /**
1277      * This method installs the user specified SAX Document Handler
1278      * callback function on parser.
1279      *
1280      * @param handler A pointer to the document handler to be called
1281      *                when the parser comes across 'document' events
1282      *                as per the SAX specification.
1283      *
1284      * @see Parser#parse(char*)
1285      */
1286    virtual void setDocumentHandler(DocumentHandler* const handler);
1287
1288    /**
1289      * This method installs the user specified DTD handler on the parser.
1290      *
1291      * @param handler A pointer to the DTD handler to be called
1292      *                when the parser comes across 'DTD' events
1293      *                as per the SAX specification.
1294      *
1295      * @see Parser#setDTDHandler
1296      */
1297    virtual void setDTDHandler(DTDHandler* const handler);
1298
1299    /**
1300      * This method installs the user specified error handler on
1301      * the parser.
1302      *
1303      * @param handler A pointer to the error handler to be called
1304      *                when the parser comes across 'error' events
1305      *                as per the SAX specification.
1306      *
1307      * @see Parser#setErrorHandler
1308      */
1309    virtual void setErrorHandler(ErrorHandler* const handler);
1310
1311    /**
1312      * This method installs the user specified PSVI handler on
1313      * the parser.
1314      *
1315      * @param handler A pointer to the PSVI handler to be called
1316      *                when the parser comes across 'PSVI' events
1317      *                as per the schema specification.
1318      *
1319      * @see Parser#setPSVIHandler
1320      */
1321    virtual void setPSVIHandler(PSVIHandler* const handler);
1322
1323    /**
1324      * This method installs the user specified entity resolver on the
1325      * parser. It allows applications to trap and redirect calls to
1326      * external entities.
1327      *
1328      * <i>Any previously set entity resolver is merely dropped, since the parser
1329      * does not own them.  If both setEntityResolver and setXMLEntityResolver
1330      * are called, then the last one is used.</i>
1331      *
1332      * @param resolver A pointer to the entity resolver to be called
1333      *                 when the parser comes across references to
1334      *                 entities in the XML file.
1335      *
1336      * @see Parser#setEntityResolver
1337      */
1338    virtual void setEntityResolver(EntityResolver* const resolver);
1339
1340    /**
1341      * This method installs the user specified entity resolver on the
1342      * parser. It allows applications to trap and redirect calls to
1343      * external entities.
1344      *
1345      * <i>Any previously set entity resolver is merely dropped, since the parser
1346      * does not own them.  If both setEntityResolver and setXMLEntityResolver
1347      * are called, then the last one is used.</i>
1348      *
1349      * @param resolver A pointer to the entity resolver to be called
1350      *                 when the parser comes across references to
1351      *                 entities in the XML file.
1352      *
1353      * @see Parser#setXMLEntityResolver
1354      */
1355    virtual void setXMLEntityResolver(XMLEntityResolver* const resolver);
1356
1357    //@}
1358
1359
1360    // -----------------------------------------------------------------------
1361    //  Implementation of the XMLDocumentHandler interface
1362    // -----------------------------------------------------------------------
1363
1364    /** @name Implementation of the XMLDocumentHandler Interface. */
1365    //@{
1366    /**
1367      * This method is used to report all the characters scanned
1368      * by the parser. The driver will invoke the 'characters'
1369      * method of the user installed SAX Document Handler.
1370      *
1371      * <p>If any advanced callback handlers are installed, the
1372      * corresponding 'docCharacters' method will also be invoked.</p>
1373      *
1374      * @param chars   A const pointer to a Unicode string representing the
1375      *                character data.
1376      * @param length  The length of the Unicode string returned in 'chars'.
1377      * @param cdataSection  A flag indicating if the characters represent
1378      *                      content from the CDATA section.
1379      * @see DocumentHandler#characters
1380      */
1381    virtual void docCharacters
1382    (
1383        const   XMLCh* const    chars
1384        , const unsigned int    length
1385        , const bool            cdataSection
1386    );
1387
1388    /**
1389      * This method is used to report any comments scanned by the parser.
1390      * This method is a no-op unless, unless an advanced callback handler
1391      * is installed, in which case the corresponding 'docComment' method
1392      * is invoked.
1393      *
1394      * @param comment A const pointer to a null terminated Unicode
1395      *                string representing the comment text.
1396      */
1397    virtual void docComment
1398    (
1399        const   XMLCh* const    comment
1400    );
1401
1402    /**
1403      * This method is used to report any PI scanned by the parser.
1404      *
1405      * <p>Any PI's occurring before any 'content' are not reported
1406      * to any SAX handler as per the specification. However, all
1407      * PI's within content are reported via the SAX Document Handler's
1408      * 'processingInstruction' method.
1409      *
1410      * <p>If any advanced callback handlers are installed, the
1411      * corresponding 'docPI' method will be invoked.</p>
1412      *
1413      * @param target A const pointer to a Unicode string representing the
1414      *               target of the PI declaration.
1415      * @param data   A const pointer to a Unicode string representing the
1416      *               data of the PI declaration. See the PI production rule
1417      *               in the XML specification for details.
1418      *
1419      * @see DocumentHandler#processingInstruction
1420      */
1421    virtual void docPI
1422    (
1423        const   XMLCh* const    target
1424        , const XMLCh* const    data
1425    );
1426
1427    /**
1428      * This method is used to indicate the end of root element
1429      * was just scanned by the parser. Corresponding 'endDocument'
1430      * method of the user installed SAX Document Handler will also
1431      * be invoked.
1432      *
1433      * <p>In addition, if any advanced callback handlers are installed,
1434      * the corresponding 'endDocument' method is invoked.</p>
1435      *
1436      * @see DocumentHandler#endDocument
1437      */
1438    virtual void endDocument();
1439
1440    /**
1441      * This method is used to indicate the end tag of an element.
1442      * The driver will invoke the corresponding 'endElement' method of
1443      * the SAX Document Handler interface.
1444      *
1445      * <p>If any advanced callback handlers are installed, the
1446      * corresponding 'endElement' method is also invoked.</p>
1447      *
1448      * @param elemDecl A const reference to the object containing element
1449      *                 declaration information.
1450      * @param urlId    An id referring to the namespace prefix, if
1451      *                 namespaces setting is switched on.
1452      * @param isRoot   A flag indicating whether this element was the
1453      *                 root element.
1454      * @param elemPrefix A const pointer to a Unicode string containing
1455      *                   the namespace prefix for this element. Applicable
1456      *                   only when namespace processing is enabled.
1457      * @see DocumentHandler#endElement
1458      */
1459    virtual void endElement
1460    (
1461        const   XMLElementDecl& elemDecl
1462        , const unsigned int    urlId
1463        , const bool            isRoot
1464        , const XMLCh* const    elemPrefix
1465    );
1466
1467    /**
1468      * This method is used to indicate that an end of an entity reference
1469      * was just scanned.
1470      *
1471      * <p>If any advanced callback handlers are installed, the
1472      * corresponding 'endEnityReference' method is invoked.</p>
1473      *
1474      * @param entDecl A const reference to the object containing the
1475      *                entity declaration information.
1476      */
1477    virtual void endEntityReference
1478    (
1479        const   XMLEntityDecl&  entDecl
1480    );
1481
1482    /**
1483      * This method is used to report all the whitespace characters,
1484      * which are determined to be 'ignorable'. This distinction
1485      * between characters is only made, if validation is enabled.
1486      * Corresponding 'ignorableWhitespace' method of the user installed
1487      * SAX Document Handler interface is called.
1488      *
1489      * <p>Any whitespace before content is not reported to the SAX
1490      * Document Handler method, as per the SAX specification.
1491      * However, if any advanced callback handlers are installed, the
1492      * corresponding 'ignorableWhitespace' method is invoked.</p>
1493      *
1494      * @param chars   A const pointer to a Unicode string representing the
1495      *                ignorable whitespace character data.
1496      * @param length  The length of the Unicode string 'chars'.
1497      * @param cdataSection  A flag indicating if the characters represent
1498      *                      content from the CDATA section.
1499      * @see DocumentHandler#ignorableWhitespace
1500      */
1501    virtual void ignorableWhitespace
1502    (
1503        const   XMLCh* const    chars
1504        , const unsigned int    length
1505        , const bool            cdataSection
1506    );
1507
1508    /**
1509      * This method allows the user installed Document Handler and
1510      * any advanced callback handlers to 'reset' themselves.
1511      */
1512    virtual void resetDocument();
1513
1514    /**
1515      * This method is used to report the start of the parsing process.
1516      * The corresponding user installed SAX Document Handler's method
1517      * 'startDocument' is invoked.
1518      *
1519      * <p>If any advanced callback handlers are installed, then the
1520      * corresponding 'startDocument' method is also called.</p>
1521      *
1522      * @see DocumentHandler#startDocument
1523      */
1524    virtual void startDocument();
1525
1526    /**
1527      * This method is used to report the start of an element. It is
1528      * called at the end of the element, by which time all attributes
1529      * specified are also parsed. The corresponding user installed
1530      * SAX Document Handler's method 'startElement' is invoked.
1531      *
1532      * <p>If any advanced callback handlers are installed, then the
1533      * corresponding 'startElement' method is also called.</p>
1534      *
1535      * @param elemDecl A const reference to the object containing element
1536      *                 declaration information.
1537      * @param urlId    An id referring to the namespace prefix, if
1538      *                 namespaces setting is switched on.
1539      * @param elemPrefix A const pointer to a Unicode string containing
1540      *                   the namespace prefix for this element. Applicable
1541      *                   only when namespace processing is enabled.
1542      * @param attrList  A const reference to the object containing the
1543      *                  list of attributes just scanned for this element.
1544      * @param attrCount A count of number of attributes in the list
1545      *                  specified by the parameter 'attrList'.
1546      * @param isEmpty  A flag indicating whether this is an empty element
1547      *                 or not.
1548      * @param isRoot   A flag indicating whether this element was the
1549      *                 root element.
1550      * @see DocumentHandler#startElement
1551      */
1552    virtual void startElement
1553    (
1554        const   XMLElementDecl&         elemDecl
1555        , const unsigned int            urlId
1556        , const XMLCh* const            elemPrefix
1557        , const RefVectorOf<XMLAttr>&   attrList
1558        , const unsigned int            attrCount
1559        , const bool                    isEmpty
1560        , const bool                    isRoot
1561    );
1562
1563    /**
1564      * This method is used to indicate the start of an entity reference.
1565      *
1566      * <p>If any advanced callback handlers are installed, the
1567      * corresponding 'endEnityReference' method is invoked.</p>
1568      *
1569      * @param entDecl A const reference to the object containing the
1570      *                entity declaration information.
1571      */
1572    virtual void startEntityReference
1573    (
1574        const   XMLEntityDecl&  entDecl
1575    );
1576
1577    /**
1578      * This method is used to report the XML decl scanned by the parser.
1579      * Refer to the XML specification to see the meaning of parameters.
1580      *
1581      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1582      * implementation.</font></b>
1583      *
1584      * @param versionStr A const pointer to a Unicode string representing
1585      *                   version string value.
1586      * @param encodingStr A const pointer to a Unicode string representing
1587      *                    the encoding string value.
1588      * @param standaloneStr A const pointer to a Unicode string
1589      *                      representing the standalone string value.
1590      * @param actualEncodingStr A const pointer to a Unicode string
1591      *                          representing the actual encoding string
1592      *                          value.
1593      */
1594    virtual void XMLDecl
1595    (
1596        const   XMLCh* const    versionStr
1597        , const XMLCh* const    encodingStr
1598        , const XMLCh* const    standaloneStr
1599        , const XMLCh* const    actualEncodingStr
1600    );
1601    //@}
1602
1603
1604    // -----------------------------------------------------------------------
1605    //  Implementation of the XMLErrorReporter interface
1606    // -----------------------------------------------------------------------
1607
1608    /** @name Implementation of the XMLErrorReporter Interface. */
1609    //@{
1610    /**
1611      * This method is used to report back errors found while parsing the
1612      * XML file. The driver will call the corresponding user installed
1613      * SAX Error Handler methods: 'fatal', 'error', 'warning' depending
1614      * on the severity of the error. This classification is defined by
1615      * the XML specification.
1616      *
1617      * @param errCode An integer code for the error.
1618      * @param msgDomain A const pointer to an Unicode string representing
1619      *                  the message domain to use.
1620      * @param errType An enumeration classifying the severity of the error.
1621      * @param errorText A const pointer to an Unicode string representing
1622      *                  the text of the error message.
1623      * @param systemId  A const pointer to an Unicode string representing
1624      *                  the system id of the XML file where this error
1625      *                  was discovered.
1626      * @param publicId  A const pointer to an Unicode string representing
1627      *                  the public id of the XML file where this error
1628      *                  was discovered.
1629      * @param lineNum   The line number where the error occurred.
1630      * @param colNum    The column number where the error occurred.
1631      * @see ErrorHandler
1632      */
1633    virtual void error
1634    (
1635        const   unsigned int                errCode
1636        , const XMLCh* const                msgDomain
1637        , const XMLErrorReporter::ErrTypes  errType
1638        , const XMLCh* const                errorText
1639        , const XMLCh* const                systemId
1640        , const XMLCh* const                publicId
1641        , const XMLSSize_t                  lineNum
1642        , const XMLSSize_t                  colNum
1643    );
1644
1645    /**
1646      * This method allows the user installed Error Handler
1647      * callback to 'reset' itself.
1648      *
1649      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1650      * implementation.</font></b>
1651      *
1652      */
1653    virtual void resetErrors();
1654    //@}
1655
1656
1657    // -----------------------------------------------------------------------
1658    //  Implementation of the XMLEntityHandler interface
1659    // -----------------------------------------------------------------------
1660
1661    /** @name Implementation of the XMLEntityHandler Interface. */
1662    //@{
1663    /**
1664      * This method is used to indicate the end of parsing of an external
1665      * entity file.
1666      *
1667      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1668      * implementation.</font></b>
1669      *
1670      * @param inputSource A const reference to the InputSource object
1671      *                    which points to the XML file being parsed.
1672      * @see InputSource
1673      */
1674    virtual void endInputSource(const InputSource& inputSource);
1675
1676    /**
1677      * This method allows an installed XMLEntityHandler to further
1678      * process any system id's of enternal entities encountered in
1679      * the XML file being parsed, such as redirection etc.
1680      *
1681      * <b><font color="#FF0000">This method always returns 'false'
1682      * for this SAX driver implementation.</font></b>
1683      *
1684      * @param systemId  A const pointer to an Unicode string representing
1685      *                  the system id scanned by the parser.
1686      * @param toFill    A pointer to a buffer in which the application
1687      *                  processed system id is stored.
1688      * @return 'true', if any processing is done, 'false' otherwise.
1689      */
1690    virtual bool expandSystemId
1691    (
1692        const   XMLCh* const    systemId
1693        ,       XMLBuffer&      toFill
1694    );
1695
1696    /**
1697      * This method allows the installed XMLEntityHandler to reset
1698      * itself.
1699      *
1700      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1701      * implementation.</font></b>
1702      */
1703    virtual void resetEntities();
1704
1705    /**
1706      * This method allows a user installed entity handler to further
1707      * process any pointers to external entities. The applications
1708      * can implement 'redirection' via this callback. The driver
1709      * should call the SAX EntityHandler 'resolveEntity' method.
1710      *
1711      * @deprecated This method is no longer called (the other resolveEntity one is).
1712      *
1713      * @param publicId A const pointer to a Unicode string representing the
1714      *                 public id of the entity just parsed.
1715      * @param systemId A const pointer to a Unicode string representing the
1716      *                 system id of the entity just parsed.
1717      * @param baseURI  A const pointer to a Unicode string representing the
1718      *                 base URI of the entity just parsed,
1719      *                 or <code>null</code> if there is no base URI.
1720      * @return The value returned by the SAX resolveEntity method or
1721      *         NULL otherwise to indicate no processing was done.
1722      *         The returned InputSource is owned by the parser which is
1723      *         responsible to clean up the memory.
1724      * @see EntityResolver
1725      * @see XMLEntityHandler
1726      */
1727    virtual InputSource* resolveEntity
1728    (
1729        const   XMLCh* const    publicId
1730        , const XMLCh* const    systemId
1731        , const XMLCh* const    baseURI = 0
1732    );
1733
1734    /** Resolve a public/system id
1735      *
1736      * This method allows a user installed entity handler to further
1737      * process any pointers to external entities. The applications can
1738      * implement 'redirection' via this callback. 
1739      *
1740      * @param resourceIdentifier An object containing the type of
1741      *        resource to be resolved and the associated data members
1742      *        corresponding to this type.
1743      * @return The value returned by the user installed resolveEntity
1744      *         method or NULL otherwise to indicate no processing was done.
1745      *         The returned InputSource is owned by the parser which is
1746      *         responsible to clean up the memory.
1747      * @see XMLEntityHandler
1748      * @see XMLEntityResolver
1749      */
1750    virtual InputSource* resolveEntity
1751    (
1752        XMLResourceIdentifier* resourceIdentifier
1753    );
1754
1755    /**
1756      * This method is used to indicate the start of parsing an
1757      * external entity file.
1758      *
1759      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1760      * implementation.</font></b>
1761      *
1762      * @param inputSource A const reference to the InputSource object
1763      *                    which points to the external entity
1764      *                    being parsed.
1765      */
1766    virtual void startInputSource(const InputSource& inputSource);
1767    //@}
1768
1769
1770    // -----------------------------------------------------------------------
1771    //  Implementation of the Deprecated DocTypeHandler Interface
1772    // -----------------------------------------------------------------------
1773    /** @name Implementation of the deprecated DocTypeHandler Interface */
1774    //@{
1775    /**
1776      * This method is used to report an attribute definition.
1777      *
1778      * <b><font color="#FF0000">This method is a no-op for this SAX
1779      * driver implementation.</font></b>
1780      *
1781      * @param elemDecl A const reference to the object containing information
1782      *                 about the element whose attribute definition was just
1783      *                 parsed.
1784      * @param attDef   A const reference to the object containing information
1785      *                 attribute definition.
1786      * @param ignore   The flag indicating whether this attribute definition
1787      *                 was ignored by the parser or not.
1788      */
1789    virtual void attDef
1790    (
1791        const   DTDElementDecl& elemDecl
1792        , const DTDAttDef&      attDef
1793        , const bool            ignore
1794    );
1795
1796    /**
1797      * This method is used to report a comment occurring within the DTD.
1798      *
1799      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1800      * implementation.</font></b>
1801      *
1802      * @param comment  A const pointer to a Unicode string representing the
1803      *                 text of the comment just parsed.
1804      */
1805    virtual void doctypeComment
1806    (
1807        const   XMLCh* const    comment
1808    );
1809
1810    /**
1811      * This method is used to report the DOCTYPE declaration.
1812      *
1813      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1814      * implementation.</font></b>
1815      *
1816      * @param elemDecl A const reference to the object containing information
1817      *                 about the root element definition declaration of the
1818      *                 XML document being parsed.
1819      * @param publicId A const pointer to a Unicode string representing the
1820      *                 public id of the DTD file.
1821      * @param systemId A const pointer to a Unicode string representing the
1822      *                 system id of the DTD file.
1823      * @param hasIntSubset A flag indicating if this XML file contains any
1824      *                     internal subset.
1825      * @param hasExtSubset A flag indicating if this XML file contains any
1826      *                     external subset. Default is false.
1827      */
1828    virtual void doctypeDecl
1829    (
1830        const   DTDElementDecl& elemDecl
1831        , const XMLCh* const    publicId
1832        , const XMLCh* const    systemId
1833        , const bool            hasIntSubset
1834        , const bool            hasExtSubset = false
1835    );
1836
1837    /**
1838      * This method is used to report any PI declarations
1839      * occurring inside the DTD definition block.
1840      *
1841      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1842      * implementation.</font></b>
1843      *
1844      * @param target A const pointer to a Unicode string representing the
1845      *               target of the PI declaration.
1846      * @param data   A const pointer to a Unicode string representing the
1847      *               data of the PI declaration. See the PI production rule
1848      *               in the XML specification for details.
1849      */
1850    virtual void doctypePI
1851    (
1852        const   XMLCh* const    target
1853        , const XMLCh* const    data
1854    );
1855
1856    /**
1857      * This method is used to report any whitespaces
1858      * occurring inside the DTD definition block.
1859      *
1860      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1861      * implementation.</font></b>
1862      *
1863      * @param chars  A const pointer to a Unicode string representing the
1864      *               whitespace characters.
1865      * @param length The length of the whitespace Unicode string.
1866      */
1867    virtual void doctypeWhitespace
1868    (
1869        const   XMLCh* const    chars
1870        , const unsigned int    length
1871    );
1872
1873    /**
1874      * This method is used to report an element declarations
1875      * successfully scanned by the parser.
1876      *
1877      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1878      * implementation.</font></b>
1879      *
1880      * @param decl   A const reference to the object containing element
1881      *               declaration information.
1882      * @param isIgnored The flag indicating whether this definition was
1883      *                  ignored by the parser or not.
1884      */
1885    virtual void elementDecl
1886    (
1887        const   DTDElementDecl& decl
1888        , const bool            isIgnored
1889    );
1890
1891    /**
1892      * This method is used to report the end of an attribute
1893      * list declaration for an element.
1894      *
1895      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1896      * implementation.</font></b>
1897      *
1898      * @param elemDecl A const reference to the object containing element
1899      *                 declaration information.
1900      */
1901    virtual void endAttList
1902    (
1903        const   DTDElementDecl& elemDecl
1904    );
1905
1906    /**
1907      * This method is used to report the end of the internal subset.
1908      *
1909      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1910      * implementation.</font></b>
1911      */
1912    virtual void endIntSubset();
1913
1914    /**
1915      * This method is used to report the end of the external subset.
1916      *
1917      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1918      * implementation.</font></b>
1919      */
1920    virtual void endExtSubset();
1921
1922    /**
1923      * This method is used to report any entity declarations.
1924      * For unparsed entities, this driver will invoke the
1925      * SAX DTDHandler::unparsedEntityDecl callback.
1926      *
1927      * @param entityDecl A const reference to the object containing
1928      *                   the entity declaration information.
1929      * @param isPEDecl  The flag indicating whether this was a
1930      *                  parameter entity declaration or not.
1931      * @param isIgnored The flag indicating whether this definition
1932      *                  was ignored by the parser or not.
1933      *
1934      * @see DTDHandler#unparsedEntityDecl
1935      */
1936    virtual void entityDecl
1937    (
1938        const   DTDEntityDecl&  entityDecl
1939        , const bool            isPEDecl
1940        , const bool            isIgnored
1941    );
1942
1943    /**
1944      * This method allows the user installed DTD handler to
1945      * reset itself.
1946      */
1947    virtual void resetDocType();
1948
1949    /**
1950      * This method is used to report any notation declarations.
1951      * If there is a user installed DTDHandler, then the driver will
1952      * invoke the SAX DTDHandler::notationDecl callback.
1953      *
1954      * @param notDecl A const reference to the object containing the notation
1955      *                declaration information.
1956      * @param isIgnored The flag indicating whether this definition was ignored
1957      *                  by the parser or not.
1958      *
1959      * @see DTDHandler#notationDecl
1960      */
1961    virtual void notationDecl
1962    (
1963        const   XMLNotationDecl&    notDecl
1964        , const bool                isIgnored
1965    );
1966
1967    /**
1968      * This method is used to indicate the start of an element's attribute
1969      * list declaration.
1970      *
1971      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1972      * implementation.</font></b>
1973      *
1974      * @param elemDecl A const reference to the object containing element
1975      *                 declaration information.
1976      */
1977    virtual void startAttList
1978    (
1979        const   DTDElementDecl& elemDecl
1980    );
1981
1982    /**
1983      * This method is used indicate the start of the internal subset.
1984      *
1985      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1986      * implementation.</font></b>
1987      */
1988    virtual void startIntSubset();
1989
1990    /**
1991      * This method is used indicate the start of the external subset.
1992      *
1993      * <b><font color="#FF0000">This method is a no-op for this SAX driver
1994      * implementation.</font></b>
1995      */
1996    virtual void startExtSubset();
1997
1998    /**
1999      * This method is used to report the TextDecl. Refer to the XML
2000      * specification for the syntax of a TextDecl.
2001      *
2002      * <b><font color="#FF0000">This method is a no-op for this SAX driver
2003      * implementation.</font></b>
2004      *
2005      * @param versionStr A const pointer to a Unicode string representing
2006      *                   the version number of the 'version' clause.
2007      * @param encodingStr A const pointer to a Unicode string representing
2008      *                    the encoding name of the 'encoding' clause.
2009      */
2010    virtual void TextDecl
2011    (
2012        const   XMLCh* const    versionStr
2013        , const XMLCh* const    encodingStr
2014    );
2015    //@}
2016
2017
2018    // -----------------------------------------------------------------------
2019    //  Deprecated Methods
2020    // -----------------------------------------------------------------------
2021    /** @name Deprecated Methods */
2022    //@{
2023    /**
2024      * This method returns the state of the parser's validation
2025      * handling flag which controls whether validation checks
2026      * are enforced or not.
2027      *
2028      * @return true, if the parser is currently configured to
2029      *         do validation, false otherwise.
2030      *
2031      * @see #setDoValidation
2032      */
2033    bool getDoValidation() const;
2034
2035    /**
2036      * This method allows users to enable or disable the parser's validation
2037      * checks.
2038      *
2039      * <p>By default, the parser does not to any validation. The default
2040      * value is false.</p>
2041      *
2042      * @param newState The value specifying whether the parser should
2043      *                 do validity checks or not against the DTD in the
2044      *                 input XML document.
2045      *
2046      * @see #getDoValidation
2047      */
2048    void setDoValidation(const bool newState);
2049    //@}
2050
2051
2052protected :
2053    // -----------------------------------------------------------------------
2054    //  Protected Methods
2055    // -----------------------------------------------------------------------
2056    /**
2057      * This method returns a reference to the underlying scanner object.
2058      * It allows read only access to data maintained in the scanner.
2059      *
2060      * @return A const reference to the underlying scanner object.
2061      */
2062    const XMLScanner& getScanner() const;
2063
2064    /** Get the Grammar resolver
2065      *
2066      * This provides derived classes with access to the grammar resolver.
2067      */
2068    GrammarResolver* getGrammarResolver() const;
2069
2070
2071private:
2072    // -----------------------------------------------------------------------
2073    //  Unimplemented constructors and operators
2074    // -----------------------------------------------------------------------
2075    SAXParser(const SAXParser&);
2076    SAXParser& operator=(const SAXParser&);
2077
2078    // -----------------------------------------------------------------------
2079    //  Initialize/Cleanup methods
2080    // -----------------------------------------------------------------------
2081    void initialize();
2082    void cleanUp();
2083
2084    // -----------------------------------------------------------------------
2085    //  Private data members
2086    //
2087    //  fAttrList
2088    //      A temporary implementation of the basic SAX attribute list
2089    //      interface. We use this one over and over on each startElement
2090    //      event to allow SAX-like access to the element attributes.
2091    //
2092    //  fDocHandler
2093    //      The installed SAX doc handler, if any. Null if none.
2094    //
2095    //  fDTDHandler
2096    //      The installed SAX DTD handler, if any. Null if none.
2097    //
2098    //  fElemDepth
2099    //      This is used to track the element nesting depth, so that we can
2100    //      know when we are inside content. This is so we can ignore char
2101    //      data outside of content.
2102    //
2103    //  fEntityResolver
2104    //      The installed SAX entity handler, if any. Null if none.
2105    //
2106    //  fErrorHandler
2107    //      The installed SAX error handler, if any. Null if none.
2108    //
2109    //  fPSVIHandler
2110    //      The installed PSVI handler, if any. Null if none.
2111    //
2112    //  fAdvDHCount
2113    //  fAdvDHList
2114    //  fAdvDHListSize
2115    //      This is an array of pointers to XMLDocumentHandlers, which is
2116    //      how we see installed advanced document handlers. There will
2117    //      usually not be very many at all, so a simple array is used
2118    //      instead of a collection, for performance. It will grow if needed,
2119    //      but that is unlikely.
2120    //
2121    //      The count is how many handlers are currently installed. The size
2122    //      is how big the array itself is (for expansion purposes.) When
2123    //      count == size, is time to expand.
2124    //
2125    //  fParseInProgress
2126    //      This flag is set once a parse starts. It is used to prevent
2127    //      multiple entrance or reentrance of the parser.
2128    //
2129    //  fScanner
2130    //      The scanner being used by this parser. It is created internally
2131    //      during construction.
2132    //
2133    //   fGrammarPool
2134    //      The grammar pool passed from external application (through derivatives).
2135    //      which could be 0, not owned.
2136    //
2137    // -----------------------------------------------------------------------
2138    bool                 fParseInProgress;
2139    unsigned int         fElemDepth;
2140    unsigned int         fAdvDHCount;
2141    unsigned int         fAdvDHListSize;
2142    VecAttrListImpl      fAttrList;
2143    DocumentHandler*     fDocHandler;
2144    DTDHandler*          fDTDHandler;
2145    EntityResolver*      fEntityResolver;
2146    XMLEntityResolver*   fXMLEntityResolver;
2147    ErrorHandler*        fErrorHandler;
2148    PSVIHandler*         fPSVIHandler;
2149    XMLDocumentHandler** fAdvDHList;
2150    XMLScanner*          fScanner;
2151    GrammarResolver*     fGrammarResolver;
2152    XMLStringPool*       fURIStringPool;
2153    XMLValidator*        fValidator;
2154    MemoryManager*       fMemoryManager;
2155    XMLGrammarPool*      fGrammarPool;
2156    XMLBuffer            fElemQNameBuf;
2157};
2158
2159
2160// ---------------------------------------------------------------------------
2161//  SAXParser: Getter methods
2162// ---------------------------------------------------------------------------
2163inline DocumentHandler* SAXParser::getDocumentHandler()
2164{
2165    return fDocHandler;
2166}
2167
2168inline const DocumentHandler* SAXParser::getDocumentHandler() const
2169{
2170    return fDocHandler;
2171}
2172
2173inline EntityResolver* SAXParser::getEntityResolver()
2174{
2175    return fEntityResolver;
2176}
2177
2178inline XMLEntityResolver* SAXParser::getXMLEntityResolver()
2179{
2180    return fXMLEntityResolver;
2181}
2182
2183inline const XMLEntityResolver* SAXParser::getXMLEntityResolver() const
2184{
2185    return fXMLEntityResolver;
2186}
2187
2188inline const EntityResolver* SAXParser::getEntityResolver() const
2189{
2190    return fEntityResolver;
2191}
2192
2193inline ErrorHandler* SAXParser::getErrorHandler()
2194{
2195    return fErrorHandler;
2196}
2197
2198inline const ErrorHandler* SAXParser::getErrorHandler() const
2199{
2200    return fErrorHandler;
2201}
2202
2203inline PSVIHandler* SAXParser::getPSVIHandler()
2204{
2205    return fPSVIHandler;
2206}
2207
2208inline const PSVIHandler* SAXParser::getPSVIHandler() const
2209{
2210    return fPSVIHandler;
2211}
2212
2213inline const XMLScanner& SAXParser::getScanner() const
2214{
2215    return *fScanner;
2216}
2217
2218inline GrammarResolver* SAXParser::getGrammarResolver() const
2219{
2220    return fGrammarResolver;
2221}
2222
2223XERCES_CPP_NAMESPACE_END
2224
2225#endif
Note: See TracBrowser for help on using the repository browser.