source: NonGTP/Xerces/xerces/include/xercesc/internal/XMLScanner.hpp @ 358

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

xerces added

Line 
1/*
2 * Copyright 1999-2002,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: XMLScanner.hpp,v $
19 * Revision 1.42  2004/09/29 21:23:34  peiyongz
20 * default implementation provided
21 *
22 * Revision 1.41  2004/09/29 19:00:02  peiyongz
23 * [jira1207] --patch from Dan Rosen
24 *
25 * Revision 1.40  2004/09/28 21:27:38  peiyongz
26 * Optimized duplicated attributes checking for large number of attributes
27 *
28 * Revision 1.39  2004/09/28 02:14:13  cargilld
29 * Add support for validating annotations.
30 *
31 * Revision 1.38  2004/09/23 01:09:55  cargilld
32 * 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.
33 *
34 * Revision 1.37  2004/09/08 13:56:14  peiyongz
35 * Apache License Version 2.0
36 *
37 * Revision 1.36  2004/06/14 15:18:53  peiyongz
38 * Consolidated End Of Line Handling
39 *
40 * Revision 1.35  2004/04/13 18:57:54  peiyongz
41 * Unrelavant comment removal
42 *
43 * Revision 1.34  2004/04/13 16:56:58  peiyongz
44 * IdentityConstraintHandler
45 *
46 * Revision 1.33  2004/04/07 14:15:12  peiyongz
47 * allow internalDTD (conditionally) with grammar reusing
48 *
49 * Revision 1.32  2003/12/31 15:40:00  cargilld
50 * Release memory when an error is encountered.
51 *
52 * Revision 1.31  2003/11/28 21:18:32  knoaman
53 * Make use of canonical representation in PSVIElement
54 *
55 * Revision 1.30  2003/11/28 19:54:31  knoaman
56 * PSVIElement update
57 *
58 * Revision 1.29  2003/11/27 22:52:37  knoaman
59 * PSVIElement implementation
60 *
61 * Revision 1.28  2003/11/24 05:09:38  neilg
62 * implement new, statless, method for detecting duplicate attributes
63 *
64 * Revision 1.27  2003/11/13 15:00:44  peiyongz
65 * Solve Compilation/Linkage error on AIX/Solaris/HP/Linux
66 *
67 * Revision 1.26  2003/11/12 20:29:47  peiyongz
68 * Stateless Grammar: ValidationContext
69 *
70 * Revision 1.25  2003/11/06 15:30:06  neilg
71 * 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.
72 *
73 * Revision 1.24  2003/10/22 20:22:30  knoaman
74 * Prepare for annotation support.
75 *
76 * Revision 1.23  2003/07/10 19:47:24  peiyongz
77 * Stateless Grammar: Initialize scanner with grammarResolver,
78 *                                creating grammar through grammarPool
79 *
80 * Revision 1.22  2003/05/16 21:36:58  knoaman
81 * Memory manager implementation: Modify constructors to pass in the memory manager.
82 *
83 * Revision 1.21  2003/05/15 18:26:29  knoaman
84 * Partial implementation of the configurable memory manager.
85 *
86 * Revision 1.20  2003/04/22 14:52:37  knoaman
87 * Initialize security manager in constructor.
88 *
89 * Revision 1.19  2003/04/17 22:00:46  neilg
90 * This commit implements detection of exponential entity
91 * expansions inside the scanner code.  This is only done when a
92 * security manager instance has been registered with the parser by
93 * the application.  The default number of entities which may be
94 * expanded is 50000; this appears to work very well for SAX, but DOM
95 * parsing applications may wish to set this limit considerably lower.
96 *
97 * Added SecurityManager to enable detection of exponentially-expanding entities
98 *
99 * Revision 1.18  2003/03/10 15:27:29  tng
100 * XML1.0 Errata E38
101 *
102 * Revision 1.17  2003/03/07 18:08:58  tng
103 * Return a reference instead of void for operator=
104 *
105 * Revision 1.16  2003/01/03 20:08:40  tng
106 * New feature StandardUriConformant to force strict standard uri conformance.
107 *
108 * Revision 1.15  2002/12/27 16:16:51  knoaman
109 * Set scanner options and handlers.
110 *
111 * Revision 1.14  2002/12/20 22:09:56  tng
112 * XML 1.1
113 *
114 * Revision 1.13  2002/12/04 01:41:14  knoaman
115 * Scanner re-organization.
116 *
117 * Revision 1.12  2002/11/04 14:58:19  tng
118 * C++ Namespace Support.
119 *
120 * Revision 1.11  2002/08/27 05:56:39  knoaman
121 * Identity Constraint: handle case of recursive elements.
122 *
123 * Revision 1.10  2002/08/16 15:46:17  knoaman
124 * Bug 7698 : filenames with embedded spaces in schemaLocation strings not handled properly.
125 *
126 * Revision 1.9  2002/07/31 18:49:29  tng
127 * [Bug 6227] Make method getLastExtLocation() constant.
128 *
129 * Revision 1.8  2002/07/11 18:22:13  knoaman
130 * Grammar caching/preparsing - initial implementation.
131 *
132 * Revision 1.7  2002/06/17 16:13:01  tng
133 * DOM L3: Add the flag fNormalizeData so that datatype normalization defined by schema is done only if asked.
134 *
135 * Revision 1.6  2002/06/07 18:35:49  tng
136 * Add getReaderMgr in XMLScanner so that the parser can query encoding information.
137 *
138 * Revision 1.5  2002/05/30 16:20:57  tng
139 * Add feature to optionally ignore external DTD.
140 *
141 * Revision 1.4  2002/05/27 18:42:14  tng
142 * To get ready for 64 bit large file, use XMLSSize_t to represent line and column number.
143 *
144 * Revision 1.3  2002/05/22 20:54:33  knoaman
145 * Prepare for DOM L3 :
146 * - Make use of the XMLEntityHandler/XMLErrorReporter interfaces, instead of using
147 * EntityHandler/ErrorHandler directly.
148 * - Add 'AbstractDOMParser' class to provide common functionality for XercesDOMParser
149 * and DOMBuilder.
150 *
151 * Revision 1.2  2002/03/25 20:25:32  knoaman
152 * Move particle derivation checking from TraverseSchema to SchemaValidator.
153 *
154 * Revision 1.1.1.1  2002/02/01 22:22:03  peiyongz
155 * sane_include
156 *
157 * Revision 1.38  2001/11/30 22:19:15  peiyongz
158 * cleanUp function made member function
159 * cleanUp object moved to file scope
160 *
161 * Revision 1.37  2001/11/20 18:51:44  tng
162 * 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).
163 *
164 * Revision 1.36  2001/11/13 13:27:28  tng
165 * Move root element check to XMLScanner.
166 *
167 * Revision 1.35  2001/11/02 14:20:14  knoaman
168 * Add support for identity constraints.
169 *
170 * Revision 1.34  2001/10/12 20:52:18  tng
171 * Schema: Find the attributes see if they should be (un)qualified.
172 *
173 * Revision 1.33  2001/09/10 15:16:04  tng
174 * Store the fGrammarType instead of calling getGrammarType all the time for faster performance.
175 *
176 * Revision 1.32  2001/09/10 14:06:22  tng
177 * Schema: AnyAttribute support in Scanner and Validator.
178 *
179 * Revision 1.31  2001/08/13 15:06:39  knoaman
180 * update <any> validation.
181 *
182 * Revision 1.30  2001/08/02 16:54:39  tng
183 * Reset some Scanner flags in scanReset().
184 *
185 * Revision 1.29  2001/08/01 19:11:01  tng
186 * Add full schema constraint checking flag to the samples and the parser.
187 *
188 * Revision 1.28  2001/07/24 21:23:39  tng
189 * Schema: Use DatatypeValidator for ID/IDREF/ENTITY/ENTITIES/NOTATION.
190 *
191 * Revision 1.27  2001/07/13 16:56:48  tng
192 * ScanId fix.
193 *
194 * Revision 1.26  2001/07/12 18:50:17  tng
195 * Some performance modification regarding standalone check and xml decl check.
196 *
197 * Revision 1.25  2001/07/10 21:09:31  tng
198 * Give proper error messsage when scanning external id.
199 *
200 * Revision 1.24  2001/07/09 13:42:08  tng
201 * Partial Markup in Parameter Entity is validity constraint and thus should be just error, not fatal error.
202 *
203 * Revision 1.23  2001/07/05 13:12:11  tng
204 * Standalone checking is validity constraint and thus should be just error, not fatal error:
205 *
206 * Revision 1.22  2001/06/22 12:42:33  tng
207 * [Bug 2257] 1.5 thinks a <?xml-stylesheet ...> tag is a <?xml ...> tag
208 *
209 * Revision 1.21  2001/06/04 20:59:29  jberry
210 * Add method incrementErrorCount for use by validator. Make sure to reset error count in _both_ the scanReset methods.
211 *
212 * Revision 1.20  2001/06/03 19:21:40  jberry
213 * Add support for tracking error count during parse; enables simple parse without requiring error handler.
214 *
215 * Revision 1.19  2001/05/28 20:55:02  tng
216 * Schema: allocate a fDTDValidator, fSchemaValidator explicitly to avoid wrong cast
217 *
218 * Revision 1.18  2001/05/11 15:17:28  tng
219 * Schema: Nillable fixes.
220 *
221 * Revision 1.17  2001/05/11 13:26:17  tng
222 * Copyright update.
223 *
224 * Revision 1.16  2001/05/03 20:34:29  tng
225 * Schema: SchemaValidator update
226 *
227 * Revision 1.15  2001/05/03 19:09:09  knoaman
228 * Support Warning/Error/FatalError messaging.
229 * Validity constraints errors are treated as errors, with the ability by user to set
230 * validity constraints as fatal errors.
231 *
232 * Revision 1.14  2001/04/19 18:16:59  tng
233 * Schema: SchemaValidator update, and use QName in Content Model
234 *
235 * Revision 1.13  2001/03/30 16:46:56  tng
236 * Schema: Use setDoSchema instead of setSchemaValidation which makes more sense.
237 *
238 * Revision 1.12  2001/03/30 16:35:06  tng
239 * Schema: Whitespace normalization.
240 *
241 * Revision 1.11  2001/03/21 21:56:05  tng
242 * Schema: Add Schema Grammar, Schema Validator, and split the DTDValidator into DTDValidator, DTDScanner, and DTDGrammar.
243 *
244 * Revision 1.10  2001/02/15 15:56:27  tng
245 * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
246 * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
247 * New data field  fSchemaValidation in XMLScanner as the flag.
248 *
249 * Revision 1.9  2000/04/12 22:58:28  roddey
250 * Added support for 'auto validate' mode.
251 *
252 * Revision 1.8  2000/03/03 01:29:32  roddey
253 * Added a scanReset()/parseReset() method to the scanner and
254 * parsers, to allow for reset after early exit from a progressive parse.
255 * Added calls to new Terminate() call to all of the samples. Improved
256 * documentation in SAX and DOM parsers.
257 *
258 * Revision 1.7  2000/03/02 19:54:30  roddey
259 * This checkin includes many changes done while waiting for the
260 * 1.1.0 code to be finished. I can't list them all here, but a list is
261 * available elsewhere.
262 *
263 * Revision 1.6  2000/02/24 20:18:07  abagchi
264 * Swat for removing Log from API docs
265 *
266 * Revision 1.5  2000/02/06 07:47:54  rahulj
267 * Year 2K copyright swat.
268 *
269 * Revision 1.4  2000/01/24 20:40:43  roddey
270 * Exposed the APIs to get to the byte offset in the source XML buffer. This stuff
271 * is not tested yet, but I wanted to get the API changes in now so that the API
272 * can be stablized.
273 *
274 * Revision 1.3  2000/01/12 23:52:46  roddey
275 * These are trivial changes required to get the C++ and Java versions
276 * of error messages more into sync. Mostly it was where the Java version
277 * was passing out one or more parameter than the C++ version was. In
278 * some cases the change just required an extra parameter to get the
279 * needed info to the place where the error was issued.
280 *
281 * Revision 1.2  2000/01/12 00:15:04  roddey
282 * Changes to deal with multiply nested, relative pathed, entities and to deal
283 * with the new URL class changes.
284 *
285 * Revision 1.1.1.1  1999/11/09 01:08:23  twl
286 * Initial checkin
287 *
288 * Revision 1.4  1999/11/08 20:44:52  rahul
289 * Swat for adding in Product name and CVS comment log variable.
290 *
291 */
292
293
294#if !defined(XMLSCANNER_HPP)
295#define XMLSCANNER_HPP
296
297#include <xercesc/framework/XMLBufferMgr.hpp>
298#include <xercesc/framework/XMLErrorCodes.hpp>
299#include <xercesc/framework/XMLRefInfo.hpp>
300#include <xercesc/util/PlatformUtils.hpp>
301#include <xercesc/util/NameIdPool.hpp>
302#include <xercesc/util/RefHashTableOf.hpp>
303#include <xercesc/util/SecurityManager.hpp>
304#include <xercesc/internal/ReaderMgr.hpp>
305#include <xercesc/internal/ElemStack.hpp>
306#include <xercesc/validators/DTD/DTDEntityDecl.hpp>
307#include <xercesc/framework/XMLAttr.hpp>
308#include <xercesc/framework/ValidationContext.hpp>
309#include <xercesc/validators/common/GrammarResolver.hpp>
310
311XERCES_CPP_NAMESPACE_BEGIN
312
313class InputSource;
314class XMLDocumentHandler;
315class XMLEntityHandler;
316class ErrorHandler;
317class DocTypeHandler;
318class XMLPScanToken;
319class XMLStringPool;
320class Grammar;
321class XMLValidator;
322class MemoryManager;
323class PSVIHandler;
324
325
326struct PSVIElemContext
327{
328    bool               fIsSpecified;
329    bool               fErrorOccurred;
330    int                fElemDepth;
331    int                fFullValidationDepth;
332    int                fNoneValidationDepth;
333    DatatypeValidator* fCurrentDV;
334    ComplexTypeInfo*   fCurrentTypeInfo;
335    const XMLCh*       fNormalizedValue;
336};
337
338//  This is the mondo scanner class, which does the vast majority of the
339//  work of parsing. It handles reading in input and spitting out events
340//  to installed handlers.
341class XMLPARSER_EXPORT XMLScanner : public XMemory, public XMLBufferFullHandler
342{
343public :
344    // -----------------------------------------------------------------------
345    //  Public class types
346    //
347    //  NOTE: These should really be private, but some of the compilers we
348    //  have to deal with are too stupid to understand this.
349    //
350    //  DeclTypes
351    //      Used by scanXMLDecl() to know what type of decl it should scan.
352    //      Text decls have slightly different rules from XMLDecls.
353    //
354    //  EntityExpRes
355    //      These are the values returned from the entity expansion method,
356    //      to indicate how it went.
357    //
358    //  XMLTokens
359    //      These represent the possible types of input we can get while
360    //      scanning content.
361    //
362    //  ValScheme
363    //      This indicates what the scanner should do in terms of validation.
364    //      'Auto' means if there is any int/ext subset, then validate. Else,
365    //      don't.
366    // -----------------------------------------------------------------------
367    enum DeclTypes
368    {
369        Decl_Text
370        , Decl_XML
371    };
372
373    enum EntityExpRes
374    {
375        EntityExp_Pushed
376        , EntityExp_Returned
377        , EntityExp_Failed
378    };
379
380    enum XMLTokens
381    {
382        Token_CData
383        , Token_CharData
384        , Token_Comment
385        , Token_EndTag
386        , Token_EOF
387        , Token_PI
388        , Token_StartTag
389        , Token_Unknown
390    };
391
392    enum ValSchemes
393    {
394        Val_Never
395        , Val_Always
396        , Val_Auto
397    };
398
399
400    // -----------------------------------------------------------------------
401    //  Constructors and Destructor
402    // -----------------------------------------------------------------------
403    XMLScanner
404    (
405        XMLValidator* const valToAdopt
406        , GrammarResolver* const grammarResolver
407        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
408    );
409    XMLScanner
410    (
411        XMLDocumentHandler* const  docHandler
412        , DocTypeHandler* const    docTypeHandler
413        , XMLEntityHandler* const  entityHandler
414        , XMLErrorReporter* const  errReporter
415        , XMLValidator* const      valToAdopt
416        , GrammarResolver* const grammarResolver
417        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
418    );
419    virtual ~XMLScanner();
420
421
422    // -----------------------------------------------------------------------
423    //  Error emitter methods
424    // -----------------------------------------------------------------------
425    bool emitErrorWillThrowException(const XMLErrs::Codes toEmit);
426    void emitError(const XMLErrs::Codes toEmit);
427    void emitError
428    (
429        const   XMLErrs::Codes    toEmit
430        , const XMLCh* const        text1
431        , const XMLCh* const        text2 = 0
432        , const XMLCh* const        text3 = 0
433        , const XMLCh* const        text4 = 0
434    );
435    void emitError
436    (
437        const   XMLErrs::Codes    toEmit
438        , const char* const         text1
439        , const char* const         text2 = 0
440        , const char* const         text3 = 0
441        , const char* const         text4 = 0
442    );
443
444    // -----------------------------------------------------------------------
445    //  Implementation of XMLBufferFullHandler interface
446    // -----------------------------------------------------------------------
447
448    virtual bool bufferFull(XMLBuffer& toSend)
449    {
450        sendCharData(toSend);
451        return true;
452    }
453
454    // -----------------------------------------------------------------------
455    //  Public pure virtual methods
456    // -----------------------------------------------------------------------
457    virtual const XMLCh* getName() const = 0;
458    virtual NameIdPool<DTDEntityDecl>* getEntityDeclPool() = 0;
459    virtual const NameIdPool<DTDEntityDecl>* getEntityDeclPool() const = 0;
460    virtual unsigned int resolveQName
461    (
462        const   XMLCh* const        qName
463        ,       XMLBuffer&          prefixBufToFill
464        , const short               mode
465        ,       int&                prefixColonPos
466    ) = 0;
467    virtual void scanDocument
468    (
469        const   InputSource&    src
470    ) = 0;
471    virtual bool scanNext(XMLPScanToken& toFill) = 0;
472    virtual Grammar* loadGrammar
473    (
474        const   InputSource&    src
475        , const short           grammarType
476        , const bool            toCache = false
477    ) = 0;
478
479    // -----------------------------------------------------------------------
480    //  Getter methods
481    // -----------------------------------------------------------------------
482    const XMLDocumentHandler* getDocHandler() const;
483    XMLDocumentHandler* getDocHandler();
484    const DocTypeHandler* getDocTypeHandler() const;
485    DocTypeHandler* getDocTypeHandler();
486    bool getDoNamespaces() const;
487    ValSchemes getValidationScheme() const;
488    bool getDoSchema() const;
489    bool getValidationSchemaFullChecking() const;
490    bool getIdentityConstraintChecking() const;
491    const XMLEntityHandler* getEntityHandler() const;
492    XMLEntityHandler* getEntityHandler();
493    const XMLErrorReporter* getErrorReporter() const;
494    XMLErrorReporter* getErrorReporter();
495    const ErrorHandler* getErrorHandler() const;
496    ErrorHandler* getErrorHandler();
497    const PSVIHandler* getPSVIHandler() const;
498    PSVIHandler* getPSVIHandler();
499    bool getExitOnFirstFatal() const;
500    bool getValidationConstraintFatal() const;
501    RefHashTableOf<XMLRefInfo>* getIDRefList();
502    const RefHashTableOf<XMLRefInfo>* getIDRefList() const;
503
504    ValidationContext*   getValidationContext();
505
506    bool getInException() const;
507    /*bool getLastExtLocation
508    (
509                XMLCh* const    sysIdToFill
510        , const unsigned int    maxSysIdChars
511        ,       XMLCh* const    pubIdToFill
512        , const unsigned int    maxPubIdChars
513        ,       XMLSSize_t&     lineToFill
514        ,       XMLSSize_t&     colToFill
515    ) const;*/
516    const Locator* getLocator() const;
517    const ReaderMgr* getReaderMgr() const;
518    unsigned int getSrcOffset() const;
519    bool getStandalone() const;
520    const XMLValidator* getValidator() const;
521    XMLValidator* getValidator();
522    int getErrorCount();
523    const XMLStringPool* getURIStringPool() const;
524    XMLStringPool* getURIStringPool();
525    bool getHasNoDTD() const;
526    XMLCh* getExternalSchemaLocation() const;
527    XMLCh* getExternalNoNamespaceSchemaLocation() const;
528    SecurityManager* getSecurityManager() const;
529    bool getLoadExternalDTD() const;
530    bool getNormalizeData() const;
531    bool isCachingGrammarFromParse() const;
532    bool isUsingCachedGrammarInParse() const;
533    bool getCalculateSrcOfs() const;
534    Grammar* getRootGrammar() const;
535    XMLReader::XMLVersion getXMLVersion() const;
536    MemoryManager* getMemoryManager() const;
537    ValueVectorOf<PrefMapElem*>* getNamespaceContext() const;
538    unsigned int getPrefixId(const XMLCh* const prefix) const;
539    const XMLCh* getPrefixForId(unsigned int prefId) const;
540
541    bool getGenerateSyntheticAnnotations() const;
542    bool getValidateAnnotations() const;
543
544    // -----------------------------------------------------------------------
545    //  Getter methods
546    // -----------------------------------------------------------------------
547    /**
548      * When an attribute name has no prefix, unlike elements, it is not mapped
549      * to the global namespace. So, in order to have something to map it to
550      * for practical purposes, a id for an empty URL is created and used for
551      * such names.
552      *
553      * @return The URL pool id of the URL for an empty URL "".
554      */
555    unsigned int getEmptyNamespaceId() const;
556
557    /**
558      * When a prefix is found that has not been mapped, an error is issued.
559      * However, if the parser has been instructed not to stop on the first
560      * fatal error, it needs to be able to continue. To do so, it will map
561      * that prefix tot his magic unknown namespace id.
562      *
563      * @return The URL pool id of the URL for the unknown prefix
564      *         namespace.
565      */
566    unsigned int getUnknownNamespaceId() const;
567
568    /**
569      * The prefix 'xml' is a magic prefix, defined by the XML spec and
570      * requiring no prior definition. This method returns the id for the
571      * intrinsically defined URL for this prefix.
572      *
573      * @return The URL pool id of the URL for the 'xml' prefix.
574      */
575    unsigned int getXMLNamespaceId() const;
576
577    /**
578      * The prefix 'xmlns' is a magic prefix, defined by the namespace spec
579      * and requiring no prior definition. This method returns the id for the
580      * intrinsically defined URL for this prefix.
581      *
582      * @return The URL pool id of the URL for the 'xmlns' prefix.
583      */
584    unsigned int getXMLNSNamespaceId() const;
585
586    /**
587      * This method find the passed URI id in its URI pool and
588      * copy the text of that URI into the passed buffer.
589      */
590    bool getURIText
591    (
592        const   unsigned int    uriId
593        ,       XMLBuffer&      uriBufToFill
594    )   const;
595
596    const XMLCh* getURIText(const   unsigned int    uriId) const;
597
598    /* tell if the validator comes from user */
599    bool isValidatorFromUser();
600
601    /* tell if standard URI are forced */
602    bool getStandardUriConformant() const;
603
604    // -----------------------------------------------------------------------
605    //  Setter methods
606    // -----------------------------------------------------------------------
607    void setDocHandler(XMLDocumentHandler* const docHandler);
608    void setDocTypeHandler(DocTypeHandler* const docTypeHandler);
609    void setDoNamespaces(const bool doNamespaces);
610    void setEntityHandler(XMLEntityHandler* const docTypeHandler);
611    void setErrorReporter(XMLErrorReporter* const errHandler);
612    void setErrorHandler(ErrorHandler* const handler);
613    void setPSVIHandler(PSVIHandler* const handler);
614    void setURIStringPool(XMLStringPool* const stringPool);
615    void setExitOnFirstFatal(const bool newValue);
616    void setValidationConstraintFatal(const bool newValue);
617    void setValidationScheme(const ValSchemes newScheme);
618    void setValidator(XMLValidator* const valToAdopt);
619    void setDoSchema(const bool doSchema);
620    void setValidationSchemaFullChecking(const bool schemaFullChecking);
621    void setIdentityConstraintChecking(const bool identityConstraintChecking);
622    void setHasNoDTD(const bool hasNoDTD);
623    void cacheGrammarFromParse(const bool newValue);
624    void useCachedGrammarInParse(const bool newValue);
625    void setRootElemName(XMLCh* rootElemName);
626    void setExternalSchemaLocation(const XMLCh* const schemaLocation);
627    void setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation);
628    void setExternalSchemaLocation(const char* const schemaLocation);
629    void setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation);
630    void setSecurityManager(SecurityManager* const securityManager);
631    void setLoadExternalDTD(const bool loadDTD);
632    void setNormalizeData(const bool normalizeData);
633    void setCalculateSrcOfs(const bool newValue);
634    void setParseSettings(XMLScanner* const refScanner);
635    void setStandardUriConformant(const bool newValue);
636    void setInputBufferSize(const size_t bufferSize);
637
638    void setGenerateSyntheticAnnotations(const bool newValue);
639    void setValidateAnnotations(const bool newValue);
640
641    // -----------------------------------------------------------------------
642    //  Mutator methods
643    // -----------------------------------------------------------------------
644    void incrementErrorCount(void);                     // For use by XMLValidator
645
646    // -----------------------------------------------------------------------
647    //  Deprecated methods as of 3.2.0. Use getValidationScheme() and
648    //  setValidationScheme() instead.
649    // -----------------------------------------------------------------------
650    bool getDoValidation() const;
651    void setDoValidation(const bool validate);
652
653    // -----------------------------------------------------------------------
654    //  Document scanning methods
655    //
656    //  scanDocument() does the entire source document. scanFirst(),
657    //  scanNext(), and scanReset() support a progressive parse.
658    // -----------------------------------------------------------------------
659    void scanDocument
660    (
661        const   XMLCh* const    systemId
662    );
663    void scanDocument
664    (
665        const   char* const     systemId
666    );
667
668    bool scanFirst
669    (
670        const   InputSource&    src
671        ,       XMLPScanToken&  toFill
672    );
673    bool scanFirst
674    (
675        const   XMLCh* const    systemId
676        ,       XMLPScanToken&  toFill
677    );
678    bool scanFirst
679    (
680        const   char* const     systemId
681        ,       XMLPScanToken&  toFill
682    );
683
684    void scanReset(XMLPScanToken& toFill);
685
686    bool checkXMLDecl(bool startWithAngle);
687
688    // -----------------------------------------------------------------------
689    //  Grammar preparsing methods
690    // -----------------------------------------------------------------------
691    Grammar* loadGrammar
692    (
693        const   XMLCh* const    systemId
694        , const short           grammarType
695        , const bool            toCache = false
696    );
697    Grammar* loadGrammar
698    (
699        const   char* const     systemId
700        , const short           grammarType
701        , const bool            toCache = false
702    );
703
704    // -----------------------------------------------------------------------
705    //  Notification that lazy data has been deleted
706    // -----------------------------------------------------------------------
707        static void reinitScannerMutex();
708        static void reinitMsgLoader();
709
710protected:
711    // -----------------------------------------------------------------------
712    //  Protected pure virtual methods
713    // -----------------------------------------------------------------------
714    virtual void scanCDSection() = 0;
715    virtual void scanCharData(XMLBuffer& toToUse) = 0;
716    virtual EntityExpRes scanEntityRef
717    (
718        const   bool    inAttVal
719        ,       XMLCh&  firstCh
720        ,       XMLCh&  secondCh
721        ,       bool&   escaped
722    ) = 0;
723    virtual void scanDocTypeDecl() = 0;
724    virtual void scanReset(const InputSource& src) = 0;
725    virtual void sendCharData(XMLBuffer& toSend) = 0;
726
727    //return owned by the caller
728    virtual InputSource* resolveSystemId(const XMLCh* const sysId) {return 0;};
729
730    // -----------------------------------------------------------------------
731    //  Protected scanning methods
732    // -----------------------------------------------------------------------
733    bool scanCharRef(XMLCh& toFill, XMLCh& second);
734    void scanComment();
735    bool scanEq(bool inDecl = false);
736    void scanMiscellaneous();
737    void scanPI();
738    void scanProlog();
739    void scanXMLDecl(const DeclTypes type);
740
741    // -----------------------------------------------------------------------
742    //  Private helper methods
743    // -----------------------------------------------------------------------
744    void checkInternalDTD(bool hasExtSubset, const XMLCh* const sysId);
745    void checkIDRefs();
746    bool isLegalToken(const XMLPScanToken& toCheck);
747    XMLTokens senseNextToken(unsigned int& orgReader);
748    void initValidator(XMLValidator* theValidator);
749    inline void resetValidationContext();
750    unsigned int *getNewUIntPtr();
751    void resetUIntPool();
752    void recreateUIntPool();
753
754    inline
755    void setAttrDupChkRegistry
756         (
757            const unsigned int &attrNumber
758          ,       bool         &toUseHashTable
759         );
760
761    // -----------------------------------------------------------------------
762    //  Data members
763    //
764    //  fBufferSize
765    //      Maximum input buffer size
766    //
767    //  fAttrList
768    //      Every time we get a new element start tag, we have to pass to
769    //      the document handler the attributes found. To make it more
770    //      efficient we keep this ref vector of XMLAttr objects around. We
771    //      just reuse it over and over, allowing it to grow to meet the
772    //      peak need.
773    //
774    //  fBufMgr
775    //      This is a manager for temporary buffers used during scanning.
776    //      For efficiency we must use a set of static buffers, but we have
777    //      to insure that they are not incorrectly reused. So this manager
778    //      provides the smarts to hand out buffers as required.
779    //
780    //  fDocHandler
781    //      The client code's document handler. If zero, then no document
782    //      handler callouts are done. We don't adopt it.
783    //
784    //  fDocTypeHandler
785    //      The client code's document type handler (used by DTD Validator).
786    //
787    //  fDoNamespaces
788    //      This flag indicates whether the client code wants us to do
789    //      namespaces or not. If the installed validator indicates that it
790    //      has to do namespaces, then this is ignored.
791    //
792    //  fEntityHandler
793    //      The client code's entity handler. If zero, then no entity handler
794    //      callouts are done. We don't adopt it.
795    //
796    //  fErrorReporter
797    //      The client code's error reporter. If zero, then no error reporter
798    //      callouts are done. We don't adopt it.
799    //
800    //  fErrorHandler
801    //      The client code's error handler.  Need to store this info for
802    //      Schema parse error handling.
803    //
804    //  fPSVIHandler
805    //      The client code's PSVI handler.
806    //
807    //  fExitOnFirstFatal
808    //      This indicates whether we bail out on the first fatal XML error
809    //      or not. It defaults to true, which is the strict XML way, but it
810    //      can be changed.
811    //
812    //  fValidationConstraintFatal
813    //      This indicates whether we treat validation constraint errors as
814    //      fatal errors or not. It defaults to false, but it can be changed.
815    //
816    //  fIDRefList
817    //      This is a list of XMLRefInfo objects. This member lets us do all
818    //      needed ID-IDREF balancing checks.
819    //
820    //  fInException
821    //      To avoid a circular freakout when we catch an exception and emit
822    //      it, which would normally throw again if the 'fail on first error'
823    //      flag is one.
824    //
825    //  fReaderMgr
826    //      This is the reader manager, from which we get characters. It
827    //      manages the reader stack for us, and provides a lot of convenience
828    //      methods to do specialized checking for chars, sequences of chars,
829    //      skipping chars, etc...
830    //
831    //  fScannerId
832    //  fSequenceId
833    //      These are used for progressive parsing, to make sure that the
834    //      client code does the right thing at the right time.
835    //
836    //  fStandalone
837    //      Indicates whether the document is standalone or not. Defaults to
838    //      no, but can be overridden in the XMLDecl.
839    //
840    //  fHasNoDTD
841    //      Indicates the document has no DTD or has only an internal DTD subset
842    //      which contains no parameter entity references.
843    //
844    //  fValidate
845    //      Indicates whether any validation should be done. This is defined
846    //      by the existence of a Grammar together with fValScheme.
847    //
848    //  fValidator
849    //      The installed validator. We look at them via the abstract
850    //      validator interface, and don't know what it actual is.
851    //      Either point to user's installed validator, or fDTDValidator
852    //      or fSchemaValidator.
853    //
854    //  fValidatorFromUser
855    //      This flag indicates whether the validator was installed from
856    //      user.  If false, then the validator was created by the Scanner.
857    //
858    //  fValScheme
859    //      This is the currently set validation scheme. It defaults to
860    //      'never', but can be set by the client.
861    //
862    //  fErrorCount
863    //          The number of errors we've encountered.
864    //
865    //  fDoSchema
866    //      This flag indicates whether the client code wants Schema to
867    //      be processed or not.
868    //
869    //  fSchemaFullChecking
870    //      This flag indicates whether the client code wants full Schema
871    //      constraint checking.
872    //
873    //  fIdentityConstraintChecking
874    //      This flag indicates whether the client code wants Identity
875    //      Constraint checking, defaulted to true to maintain backward
876    //      compatibility (to minimize supprise)
877    //
878    //  fAttName
879    //  fAttValue
880    //  fCDataBuf
881    //  fNameBuf
882    //  fQNameBuf
883    //  fPrefixBuf
884    //      For the most part, buffers are obtained from the fBufMgr object
885    //      on the fly. However, for the start tag scan, we have a set of
886    //      fixed buffers for performance reasons. These are used a lot and
887    //      there are a number of them, so asking the buffer manager each
888    //      time for new buffers is a bit too much overhead.
889    //
890    //  fEmptyNamespaceId
891    //      This is the id of the empty namespace URI. This is a special one
892    //      because of the xmlns="" type of deal. We have to quickly sense
893    //      that its the empty namespace.
894    //
895    //  fUnknownNamespaceId
896    //      This is the id of the namespace URI which is assigned to the
897    //      global namespace. Its for debug purposes only, since there is no
898    //      real global namespace URI. Its set by the derived class.
899    //
900    //  fXMLNamespaceId
901    //  fXMLNSNamespaceId
902    //      These are the ids of the namespace URIs which are assigned to the
903    //      'xml' and 'xmlns' special prefixes. The former is officially
904    //      defined but the latter is not, so we just provide one for debug
905    //      purposes.
906    //
907    //  fSchemaNamespaceId
908    //      This is the id of the schema namespace URI.
909    //
910    //  fGrammarResolver
911    //      Grammar Pool that stores all the grammars. Key is namespace for
912    //      schema and system id for external DTD. When caching a grammar, if
913    //      a grammar is already in the pool, it will be replaced with the
914    //      new parsed one.
915    //
916    //  fGrammar
917    //      Current Grammar used by the Scanner and Validator
918    //
919    //  fRootGrammar
920    //      The grammar where the root element is declared.
921    //
922    //  fGrammarType
923    //      Current Grammar Type.  Store this value instead of calling getGrammarType
924    //      all the time for faster performance.
925    //
926    //  fURIStringPool
927    //      This is a pool for URIs with unique ids assigned. We use a standard
928    //      string pool class.  This pool is going to be shared by all Grammar.
929    //      Use only if namespace is turned on.
930    //
931    //  fRootElemName
932    //      No matter we are using DTD or Schema Grammar, if a DOCTYPE exists,
933    //      we need to verify the root element name.  So store the rootElement
934    //      that is used in the DOCTYPE in the Scanner instead of in the DTDGrammar
935    //      where it used to
936    //
937    //  fExternalSchemaLocation
938    //      The list of Namespace/SchemaLocation that was specified externally
939    //      using setExternalSchemaLocation.
940    //
941    //  fExternalNoNamespaceSchemaLocation
942    //      The no target namespace XML Schema Location that was specified
943    //      externally using setExternalNoNamespaceSchemaLocation.
944    //
945    //  fSecurityManager
946    //      The SecurityManager instance; as and when set by the application.
947    //
948    //  fEntityExpansionLimit
949    //      The number of entity expansions to be permitted while processing this document
950    //      Only meaningful when fSecurityManager != 0
951    //
952    //  fEntityExpansionCount
953    //      The number of general entities expanded so far in this document.
954    //      Only meaningful when fSecurityManager != null
955    //
956    //  fLoadExternalDTD
957    //      This flag indicates whether the external DTD be loaded or not
958    //
959    //  fNormalizeData
960    //      This flag indicates whether the parser should perform datatype
961    //      normalization that is defined in the schema.
962    //
963    //  fCalculateSrcOfs
964    //      This flag indicates the parser should calculate the source offset.
965    //      Turning this on may impact performance.
966    //
967    //  fStandardUriConformant
968    //      This flag controls whether we force conformant URI
969    //
970    //  fXMLVersion
971    //      Enum to indicate if the main doc is XML 1.1 or XML 1.0 conformant   
972    //  fUIntPool
973    //      pool of unsigned integers to help with duplicate attribute
974    //      detection and filling in default/fixed attributes
975    //  fUIntPoolRow
976    //      current row in fUIntPool
977    //  fUIntPoolCol
978    //      current column i row
979    //  fUIntPoolRowTotal
980    //      total number of rows in table
981    //
982    //  fMemoryManager
983    //      Pluggable memory manager for dynamic allocation/deallocation.
984    //
985    // -----------------------------------------------------------------------
986    size_t                      fBufferSize;
987    bool                        fStandardUriConformant;
988    bool                        fCalculateSrcOfs;
989    bool                        fDoNamespaces;
990    bool                        fExitOnFirstFatal;
991    bool                        fValidationConstraintFatal;
992    bool                        fInException;
993    bool                        fStandalone;
994    bool                        fHasNoDTD;
995    bool                        fValidate;
996    bool                        fValidatorFromUser;
997    bool                        fDoSchema;
998    bool                        fSchemaFullChecking;
999    bool                        fIdentityConstraintChecking;
1000    bool                        fToCacheGrammar;
1001    bool                        fUseCachedGrammar;
1002    bool                        fLoadExternalDTD;
1003    bool                        fNormalizeData;
1004    bool                        fGenerateSyntheticAnnotations;
1005    bool                        fValidateAnnotations;
1006    int                         fErrorCount;
1007    unsigned int                fEntityExpansionLimit;
1008    unsigned int                fEntityExpansionCount;
1009    unsigned int                fEmptyNamespaceId;
1010    unsigned int                fUnknownNamespaceId;
1011    unsigned int                fXMLNamespaceId;
1012    unsigned int                fXMLNSNamespaceId;
1013    unsigned int                fSchemaNamespaceId;
1014    unsigned int **             fUIntPool;
1015    unsigned int                fUIntPoolRow;
1016    unsigned int                fUIntPoolCol;
1017    unsigned int                fUIntPoolRowTotal;
1018    XMLUInt32                   fScannerId;
1019    XMLUInt32                   fSequenceId;
1020    RefVectorOf<XMLAttr>*       fAttrList;
1021    RefHash2KeysTableOf<XMLAttr>*  fAttrDupChkRegistry;   
1022    XMLDocumentHandler*         fDocHandler;
1023    DocTypeHandler*             fDocTypeHandler;
1024    XMLEntityHandler*           fEntityHandler;
1025    XMLErrorReporter*           fErrorReporter;
1026    ErrorHandler*               fErrorHandler;
1027    PSVIHandler*                fPSVIHandler;
1028    ValidationContext           *fValidationContext;
1029    bool                        fEntityDeclPoolRetrieved;
1030    ReaderMgr                   fReaderMgr;
1031    XMLValidator*               fValidator;
1032    ValSchemes                  fValScheme;
1033    GrammarResolver* const      fGrammarResolver;
1034    MemoryManager* const        fGrammarPoolMemoryManager;
1035    Grammar*                    fGrammar;
1036    Grammar*                    fRootGrammar;
1037    XMLStringPool*              fURIStringPool;
1038    XMLCh*                      fRootElemName;
1039    XMLCh*                      fExternalSchemaLocation;
1040    XMLCh*                      fExternalNoNamespaceSchemaLocation;
1041    SecurityManager*            fSecurityManager;
1042    XMLReader::XMLVersion       fXMLVersion;
1043    MemoryManager*              fMemoryManager;
1044    XMLBufferMgr                fBufMgr;
1045    XMLBuffer                   fAttNameBuf;
1046    XMLBuffer                   fAttValueBuf;
1047    XMLBuffer                   fCDataBuf;
1048    XMLBuffer                   fQNameBuf;
1049    XMLBuffer                   fPrefixBuf;
1050    XMLBuffer                   fURIBuf;
1051    ElemStack                   fElemStack;
1052
1053
1054private :
1055    // -----------------------------------------------------------------------
1056    //  Unimplemented constructors and operators
1057    // -----------------------------------------------------------------------
1058    XMLScanner();
1059    XMLScanner(const XMLScanner&);
1060    XMLScanner& operator=(const XMLScanner&);
1061
1062    // -----------------------------------------------------------------------
1063    //  Private helper methods
1064    // -----------------------------------------------------------------------
1065    void commonInit();
1066
1067    // -----------------------------------------------------------------------
1068    //  Private scanning methods
1069    // -----------------------------------------------------------------------
1070    bool getQuotedString(XMLBuffer& toFill);
1071    unsigned int scanUpToWSOr
1072    (
1073                XMLBuffer&  toFill
1074        , const XMLCh       chEndChar
1075    );
1076};
1077
1078// ---------------------------------------------------------------------------
1079//  XMLScanner: Getter methods
1080// ---------------------------------------------------------------------------
1081inline const XMLDocumentHandler* XMLScanner::getDocHandler() const
1082{
1083    return fDocHandler;
1084}
1085
1086inline XMLDocumentHandler* XMLScanner::getDocHandler()
1087{
1088    return fDocHandler;
1089}
1090
1091inline const DocTypeHandler* XMLScanner::getDocTypeHandler() const
1092{
1093    return fDocTypeHandler;
1094}
1095
1096inline DocTypeHandler* XMLScanner::getDocTypeHandler()
1097{
1098    return fDocTypeHandler;
1099}
1100
1101inline bool XMLScanner::getDoNamespaces() const
1102{
1103    return fDoNamespaces;
1104}
1105
1106inline const XMLEntityHandler* XMLScanner::getEntityHandler() const
1107{
1108    return fEntityHandler;
1109}
1110
1111inline XMLEntityHandler* XMLScanner::getEntityHandler()
1112{
1113    return fEntityHandler;
1114}
1115
1116inline const XMLErrorReporter* XMLScanner::getErrorReporter() const
1117{
1118    return fErrorReporter;
1119}
1120
1121inline XMLErrorReporter* XMLScanner::getErrorReporter()
1122{
1123    return fErrorReporter;
1124}
1125
1126inline const ErrorHandler* XMLScanner::getErrorHandler() const
1127{
1128    return fErrorHandler;
1129}
1130
1131inline ErrorHandler* XMLScanner::getErrorHandler()
1132{
1133    return fErrorHandler;
1134}
1135
1136inline const PSVIHandler* XMLScanner::getPSVIHandler() const
1137{
1138    return fPSVIHandler;
1139}
1140
1141inline PSVIHandler* XMLScanner::getPSVIHandler()
1142{
1143    return fPSVIHandler;
1144}
1145
1146inline bool XMLScanner::getExitOnFirstFatal() const
1147{
1148    return fExitOnFirstFatal;
1149}
1150
1151inline bool XMLScanner::getValidationConstraintFatal() const
1152{
1153    return fValidationConstraintFatal;
1154}
1155
1156inline bool XMLScanner::getInException() const
1157{
1158    return fInException;
1159}
1160
1161inline RefHashTableOf<XMLRefInfo>* XMLScanner::getIDRefList()
1162{
1163    return fValidationContext->getIdRefList();
1164}
1165
1166inline const RefHashTableOf<XMLRefInfo>* XMLScanner::getIDRefList() const
1167{
1168    return fValidationContext->getIdRefList();
1169}
1170
1171inline ValidationContext*  XMLScanner::getValidationContext()
1172{
1173    if (!fEntityDeclPoolRetrieved)
1174    {
1175        fValidationContext->setEntityDeclPool(getEntityDeclPool());
1176        fEntityDeclPoolRetrieved = true;
1177    }
1178
1179    return fValidationContext;
1180}
1181
1182inline const Locator* XMLScanner::getLocator() const
1183{
1184    return &fReaderMgr;
1185}
1186
1187inline const ReaderMgr* XMLScanner::getReaderMgr() const
1188{
1189    return &fReaderMgr;
1190}
1191
1192inline unsigned int XMLScanner::getSrcOffset() const
1193{
1194    return fReaderMgr.getSrcOffset();
1195}
1196
1197inline bool XMLScanner::getStandalone() const
1198{
1199    return fStandalone;
1200}
1201
1202inline XMLScanner::ValSchemes XMLScanner::getValidationScheme() const
1203{
1204    return fValScheme;
1205}
1206
1207inline const XMLValidator* XMLScanner::getValidator() const
1208{
1209    return fValidator;
1210}
1211
1212inline XMLValidator* XMLScanner::getValidator()
1213{
1214    return fValidator;
1215}
1216
1217inline bool XMLScanner::getDoSchema() const
1218{
1219    return fDoSchema;
1220}
1221
1222inline bool XMLScanner::getValidationSchemaFullChecking() const
1223{
1224    return fSchemaFullChecking;
1225}
1226
1227inline bool XMLScanner::getIdentityConstraintChecking() const
1228{
1229    return fIdentityConstraintChecking;
1230}
1231
1232inline int XMLScanner::getErrorCount()
1233{
1234    return fErrorCount;
1235}
1236
1237inline bool XMLScanner::isValidatorFromUser()
1238{
1239    return fValidatorFromUser;
1240}
1241
1242inline unsigned int XMLScanner::getEmptyNamespaceId() const
1243{
1244    return fEmptyNamespaceId;
1245}
1246
1247inline unsigned int XMLScanner::getUnknownNamespaceId() const
1248{
1249    return fUnknownNamespaceId;
1250}
1251
1252inline unsigned int XMLScanner::getXMLNamespaceId() const
1253{
1254    return fXMLNamespaceId;
1255}
1256
1257inline unsigned int XMLScanner::getXMLNSNamespaceId() const
1258{
1259    return fXMLNSNamespaceId;
1260}
1261
1262inline const XMLStringPool* XMLScanner::getURIStringPool() const
1263{
1264    return fURIStringPool;
1265}
1266
1267inline XMLStringPool* XMLScanner::getURIStringPool()
1268{
1269    return fURIStringPool;
1270}
1271
1272inline bool XMLScanner::getHasNoDTD() const
1273{
1274    return fHasNoDTD;
1275}
1276
1277inline XMLCh* XMLScanner::getExternalSchemaLocation() const
1278{
1279    return fExternalSchemaLocation;
1280}
1281
1282inline XMLCh* XMLScanner::getExternalNoNamespaceSchemaLocation() const
1283{
1284    return fExternalNoNamespaceSchemaLocation;
1285}
1286
1287inline SecurityManager* XMLScanner::getSecurityManager() const
1288{
1289    return fSecurityManager;
1290}
1291
1292inline bool XMLScanner::getLoadExternalDTD() const
1293{
1294    return fLoadExternalDTD;
1295}
1296
1297inline bool XMLScanner::getNormalizeData() const
1298{
1299    return fNormalizeData;
1300}
1301
1302inline bool XMLScanner::isCachingGrammarFromParse() const
1303{
1304    return fToCacheGrammar;
1305}
1306
1307inline bool XMLScanner::isUsingCachedGrammarInParse() const
1308{
1309    return fUseCachedGrammar;
1310}
1311
1312inline bool XMLScanner::getCalculateSrcOfs() const
1313{
1314    return fCalculateSrcOfs;
1315}
1316
1317inline Grammar* XMLScanner::getRootGrammar() const
1318{
1319    return fRootGrammar;
1320}
1321
1322inline bool XMLScanner::getStandardUriConformant() const
1323{
1324    return fStandardUriConformant;
1325}
1326
1327inline XMLReader::XMLVersion XMLScanner::getXMLVersion() const
1328{
1329        return fXMLVersion;
1330}
1331
1332inline MemoryManager* XMLScanner::getMemoryManager() const
1333{
1334    return fMemoryManager;
1335}
1336
1337inline ValueVectorOf<PrefMapElem*>* XMLScanner::getNamespaceContext() const
1338{
1339    return fElemStack.getNamespaceMap();
1340}
1341
1342inline unsigned int XMLScanner::getPrefixId(const XMLCh* const prefix) const
1343{
1344    return fElemStack.getPrefixId(prefix);
1345}
1346
1347inline const XMLCh* XMLScanner::getPrefixForId(unsigned int prefId) const
1348{
1349    return fElemStack.getPrefixForId(prefId);
1350}
1351
1352inline bool XMLScanner::getGenerateSyntheticAnnotations() const
1353{
1354    return fGenerateSyntheticAnnotations;
1355}
1356
1357inline bool XMLScanner::getValidateAnnotations() const
1358{
1359    return fValidateAnnotations;
1360}
1361
1362// ---------------------------------------------------------------------------
1363//  XMLScanner: Setter methods
1364// ---------------------------------------------------------------------------
1365inline void XMLScanner::setDocHandler(XMLDocumentHandler* const docHandler)
1366{
1367    fDocHandler = docHandler;
1368}
1369
1370inline void XMLScanner::setDocTypeHandler(DocTypeHandler* const docTypeHandler)
1371{
1372    fDocTypeHandler = docTypeHandler;
1373}
1374
1375inline void XMLScanner::setErrorHandler(ErrorHandler* const handler)
1376{
1377    fErrorHandler = handler;
1378}
1379
1380inline void XMLScanner::setPSVIHandler(PSVIHandler* const handler)
1381{
1382    fPSVIHandler = handler;
1383}
1384
1385inline void XMLScanner::setEntityHandler(XMLEntityHandler* const entityHandler)
1386{
1387    fEntityHandler = entityHandler;
1388    fReaderMgr.setEntityHandler(entityHandler);
1389}
1390
1391inline void XMLScanner::setErrorReporter(XMLErrorReporter* const errHandler)
1392{
1393    fErrorReporter = errHandler;
1394}
1395
1396inline void XMLScanner::setExitOnFirstFatal(const bool newValue)
1397{
1398    fExitOnFirstFatal = newValue;
1399}
1400
1401
1402inline void XMLScanner::setValidationConstraintFatal(const bool newValue)
1403{
1404    fValidationConstraintFatal = newValue;
1405}
1406
1407inline void XMLScanner::setValidationScheme(const ValSchemes newScheme)
1408{
1409    fValScheme = newScheme;
1410
1411    // validation flag for Val_Auto is set to false by default,
1412    //   and will be turned to true if a grammar is seen
1413    if (fValScheme == Val_Always)
1414        fValidate = true;
1415    else
1416        fValidate = false;
1417}
1418
1419inline void XMLScanner::setDoSchema(const bool doSchema)
1420{
1421    fDoSchema = doSchema;
1422}
1423
1424inline void XMLScanner::setDoNamespaces(const bool doNamespaces)
1425{
1426    fDoNamespaces = doNamespaces;
1427}
1428
1429inline void XMLScanner::setValidationSchemaFullChecking(const bool schemaFullChecking)
1430{
1431    fSchemaFullChecking = schemaFullChecking;
1432}
1433
1434inline void XMLScanner::setIdentityConstraintChecking(const bool identityConstraintChecking)
1435{
1436    fIdentityConstraintChecking = identityConstraintChecking;
1437}
1438
1439inline void XMLScanner::setHasNoDTD(const bool hasNoDTD)
1440{
1441    fHasNoDTD = hasNoDTD;
1442}
1443
1444inline void XMLScanner::setRootElemName(XMLCh* rootElemName)
1445{
1446    fMemoryManager->deallocate(fRootElemName);//delete [] fRootElemName;
1447    fRootElemName = XMLString::replicate(rootElemName, fMemoryManager);
1448}
1449
1450inline void XMLScanner::setExternalSchemaLocation(const XMLCh* const schemaLocation)
1451{
1452    fMemoryManager->deallocate(fExternalSchemaLocation);//delete [] fExternalSchemaLocation;
1453    fExternalSchemaLocation = XMLString::replicate(schemaLocation, fMemoryManager);
1454}
1455
1456inline void XMLScanner::setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation)
1457{
1458    fMemoryManager->deallocate(fExternalNoNamespaceSchemaLocation);//delete [] fExternalNoNamespaceSchemaLocation;
1459    fExternalNoNamespaceSchemaLocation = XMLString::replicate(noNamespaceSchemaLocation, fMemoryManager);
1460}
1461
1462inline void XMLScanner::setExternalSchemaLocation(const char* const schemaLocation)
1463{
1464    fMemoryManager->deallocate(fExternalSchemaLocation);//delete [] fExternalSchemaLocation;
1465    fExternalSchemaLocation = XMLString::transcode(schemaLocation, fMemoryManager);
1466}
1467
1468inline void XMLScanner::setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation)
1469{
1470    fMemoryManager->deallocate(fExternalNoNamespaceSchemaLocation);//delete [] fExternalNoNamespaceSchemaLocation;
1471    fExternalNoNamespaceSchemaLocation = XMLString::transcode(noNamespaceSchemaLocation, fMemoryManager);
1472}
1473
1474inline void XMLScanner::setSecurityManager(SecurityManager* const securityManager)
1475{
1476    fSecurityManager = securityManager;
1477    if(securityManager != 0)
1478    {
1479        fEntityExpansionLimit = securityManager->getEntityExpansionLimit();
1480        fEntityExpansionCount = 0;
1481    }
1482}
1483
1484inline void XMLScanner::setLoadExternalDTD(const bool loadDTD)
1485{
1486    fLoadExternalDTD = loadDTD;
1487}
1488
1489inline void XMLScanner::setNormalizeData(const bool normalizeData)
1490{
1491    fNormalizeData = normalizeData;
1492}
1493
1494inline void XMLScanner::cacheGrammarFromParse(const bool newValue)
1495{
1496    fToCacheGrammar = newValue;
1497}
1498
1499inline void XMLScanner::useCachedGrammarInParse(const bool newValue)
1500{
1501    fUseCachedGrammar = newValue;
1502}
1503
1504inline void XMLScanner::setCalculateSrcOfs(const bool newValue)
1505{
1506    fCalculateSrcOfs = newValue;
1507}
1508
1509inline void XMLScanner::setStandardUriConformant(const bool newValue)
1510{
1511    fStandardUriConformant = newValue;
1512    fReaderMgr.setStandardUriConformant(newValue);
1513}
1514
1515inline void XMLScanner::setGenerateSyntheticAnnotations(const bool newValue)
1516{
1517    fGenerateSyntheticAnnotations = newValue;
1518}
1519
1520inline void XMLScanner::setValidateAnnotations(const bool newValue)
1521{
1522    fValidateAnnotations = newValue;
1523}
1524
1525inline void XMLScanner::setInputBufferSize(const size_t bufferSize)
1526{
1527    fBufferSize = bufferSize;
1528    fCDataBuf.setFullHandler(this, fBufferSize);
1529}
1530
1531// ---------------------------------------------------------------------------
1532//  XMLScanner: Mutator methods
1533// ---------------------------------------------------------------------------
1534inline void XMLScanner::incrementErrorCount()
1535{
1536    ++fErrorCount;
1537}
1538
1539// ---------------------------------------------------------------------------
1540//  XMLScanner: Deprecated methods
1541// ---------------------------------------------------------------------------
1542inline bool XMLScanner::getDoValidation() const
1543{
1544    return fValidate;
1545}
1546
1547inline void XMLScanner::setDoValidation(const bool validate)
1548{
1549    fValidate = validate;
1550    if (fValidate)
1551        fValScheme = Val_Always;
1552    else
1553        fValScheme = Val_Never;
1554}
1555
1556inline void XMLScanner::resetValidationContext()
1557{
1558    fValidationContext->clearIdRefList();
1559    fValidationContext->setEntityDeclPool(0);
1560    fEntityDeclPoolRetrieved = false;
1561}
1562
1563inline void XMLScanner::setAttrDupChkRegistry(const unsigned int &attrNumber
1564                                            ,       bool         &toUseHashTable)
1565{
1566   // once the attribute exceed 20, we use hash table to check duplication
1567    if (attrNumber > 20)
1568   {
1569        toUseHashTable = true;
1570
1571        if (!fAttrDupChkRegistry)
1572        {
1573            fAttrDupChkRegistry = new (fMemoryManager) RefHash2KeysTableOf<XMLAttr>
1574            (
1575              2*attrNumber+1, false, new (fMemoryManager)HashXMLCh(), fMemoryManager
1576            );
1577        }
1578        else
1579        {
1580            fAttrDupChkRegistry->removeAll();
1581        }
1582    }
1583
1584}
1585
1586XERCES_CPP_NAMESPACE_END
1587
1588#endif
1589
Note: See TracBrowser for help on using the repository browser.