source: NonGTP/Xerces/xerces/include/xercesc/parsers/SAXParser.hpp @ 358

Revision 358, 85.6 KB checked in by bittner, 19 years ago (diff)

xerces added

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