XMLScanner.hpp
上传用户:huihehuasu
上传日期:2007-01-10
资源大小:6948k
文件大小:44k
源码类别:

xml/soap/webservice

开发平台:

C/C++

  1. /*
  2.  * The Apache Software License, Version 1.1
  3.  *
  4.  * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  5.  * reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  *
  11.  * 1. Redistributions of source code must retain the above copyright
  12.  *    notice, this list of conditions and the following disclaimer.
  13.  *
  14.  * 2. Redistributions in binary form must reproduce the above copyright
  15.  *    notice, this list of conditions and the following disclaimer in
  16.  *    the documentation and/or other materials provided with the
  17.  *    distribution.
  18.  *
  19.  * 3. The end-user documentation included with the redistribution,
  20.  *    if any, must include the following acknowledgment:
  21.  *       "This product includes software developed by the
  22.  *        Apache Software Foundation (http://www.apache.org/)."
  23.  *    Alternately, this acknowledgment may appear in the software itself,
  24.  *    if and wherever such third-party acknowledgments normally appear.
  25.  *
  26.  * 4. The names "Xerces" and "Apache Software Foundation" must
  27.  *    not be used to endorse or promote products derived from this
  28.  *    software without prior written permission. For written
  29.  *    permission, please contact apache@apache.org.
  30.  *
  31.  * 5. Products derived from this software may not be called "Apache",
  32.  *    nor may "Apache" appear in their name, without prior written
  33.  *    permission of the Apache Software Foundation.
  34.  *
  35.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  36.  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  37.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  38.  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  39.  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  40.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  41.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  42.  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  43.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  44.  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  45.  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  46.  * SUCH DAMAGE.
  47.  * ====================================================================
  48.  *
  49.  * This software consists of voluntary contributions made by many
  50.  * individuals on behalf of the Apache Software Foundation, and was
  51.  * originally based on software copyright (c) 1999, International
  52.  * Business Machines, Inc., http://www.ibm.com .  For more information
  53.  * on the Apache Software Foundation, please see
  54.  * <http://www.apache.org/>.
  55.  */
  56. /*
  57.  * $Log: XMLScanner.hpp,v $
  58.  * Revision 1.38  2001/11/30 22:19:15  peiyongz
  59.  * cleanUp function made member function
  60.  * cleanUp object moved to file scope
  61.  *
  62.  * Revision 1.37  2001/11/20 18:51:44  tng
  63.  * 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).
  64.  *
  65.  * Revision 1.36  2001/11/13 13:27:28  tng
  66.  * Move root element check to XMLScanner.
  67.  *
  68.  * Revision 1.35  2001/11/02 14:20:14  knoaman
  69.  * Add support for identity constraints.
  70.  *
  71.  * Revision 1.34  2001/10/12 20:52:18  tng
  72.  * Schema: Find the attributes see if they should be (un)qualified.
  73.  *
  74.  * Revision 1.33  2001/09/10 15:16:04  tng
  75.  * Store the fGrammarType instead of calling getGrammarType all the time for faster performance.
  76.  *
  77.  * Revision 1.32  2001/09/10 14:06:22  tng
  78.  * Schema: AnyAttribute support in Scanner and Validator.
  79.  *
  80.  * Revision 1.31  2001/08/13 15:06:39  knoaman
  81.  * update <any> validation.
  82.  *
  83.  * Revision 1.30  2001/08/02 16:54:39  tng
  84.  * Reset some Scanner flags in scanReset().
  85.  *
  86.  * Revision 1.29  2001/08/01 19:11:01  tng
  87.  * Add full schema constraint checking flag to the samples and the parser.
  88.  *
  89.  * Revision 1.28  2001/07/24 21:23:39  tng
  90.  * Schema: Use DatatypeValidator for ID/IDREF/ENTITY/ENTITIES/NOTATION.
  91.  *
  92.  * Revision 1.27  2001/07/13 16:56:48  tng
  93.  * ScanId fix.
  94.  *
  95.  * Revision 1.26  2001/07/12 18:50:17  tng
  96.  * Some performance modification regarding standalone check and xml decl check.
  97.  *
  98.  * Revision 1.25  2001/07/10 21:09:31  tng
  99.  * Give proper error messsage when scanning external id.
  100.  *
  101.  * Revision 1.24  2001/07/09 13:42:08  tng
  102.  * Partial Markup in Parameter Entity is validity constraint and thus should be just error, not fatal error.
  103.  *
  104.  * Revision 1.23  2001/07/05 13:12:11  tng
  105.  * Standalone checking is validity constraint and thus should be just error, not fatal error:
  106.  *
  107.  * Revision 1.22  2001/06/22 12:42:33  tng
  108.  * [Bug 2257] 1.5 thinks a <?xml-stylesheet ...> tag is a <?xml ...> tag
  109.  *
  110.  * Revision 1.21  2001/06/04 20:59:29  jberry
  111.  * Add method incrementErrorCount for use by validator. Make sure to reset error count in _both_ the scanReset methods.
  112.  *
  113.  * Revision 1.20  2001/06/03 19:21:40  jberry
  114.  * Add support for tracking error count during parse; enables simple parse without requiring error handler.
  115.  *
  116.  * Revision 1.19  2001/05/28 20:55:02  tng
  117.  * Schema: allocate a fDTDValidator, fSchemaValidator explicitly to avoid wrong cast
  118.  *
  119.  * Revision 1.18  2001/05/11 15:17:28  tng
  120.  * Schema: Nillable fixes.
  121.  *
  122.  * Revision 1.17  2001/05/11 13:26:17  tng
  123.  * Copyright update.
  124.  *
  125.  * Revision 1.16  2001/05/03 20:34:29  tng
  126.  * Schema: SchemaValidator update
  127.  *
  128.  * Revision 1.15  2001/05/03 19:09:09  knoaman
  129.  * Support Warning/Error/FatalError messaging.
  130.  * Validity constraints errors are treated as errors, with the ability by user to set
  131.  * validity constraints as fatal errors.
  132.  *
  133.  * Revision 1.14  2001/04/19 18:16:59  tng
  134.  * Schema: SchemaValidator update, and use QName in Content Model
  135.  *
  136.  * Revision 1.13  2001/03/30 16:46:56  tng
  137.  * Schema: Use setDoSchema instead of setSchemaValidation which makes more sense.
  138.  *
  139.  * Revision 1.12  2001/03/30 16:35:06  tng
  140.  * Schema: Whitespace normalization.
  141.  *
  142.  * Revision 1.11  2001/03/21 21:56:05  tng
  143.  * Schema: Add Schema Grammar, Schema Validator, and split the DTDValidator into DTDValidator, DTDScanner, and DTDGrammar.
  144.  *
  145.  * Revision 1.10  2001/02/15 15:56:27  tng
  146.  * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
  147.  * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
  148.  * New data field  fSchemaValidation in XMLScanner as the flag.
  149.  *
  150.  * Revision 1.9  2000/04/12 22:58:28  roddey
  151.  * Added support for 'auto validate' mode.
  152.  *
  153.  * Revision 1.8  2000/03/03 01:29:32  roddey
  154.  * Added a scanReset()/parseReset() method to the scanner and
  155.  * parsers, to allow for reset after early exit from a progressive parse.
  156.  * Added calls to new Terminate() call to all of the samples. Improved
  157.  * documentation in SAX and DOM parsers.
  158.  *
  159.  * Revision 1.7  2000/03/02 19:54:30  roddey
  160.  * This checkin includes many changes done while waiting for the
  161.  * 1.1.0 code to be finished. I can't list them all here, but a list is
  162.  * available elsewhere.
  163.  *
  164.  * Revision 1.6  2000/02/24 20:18:07  abagchi
  165.  * Swat for removing Log from API docs
  166.  *
  167.  * Revision 1.5  2000/02/06 07:47:54  rahulj
  168.  * Year 2K copyright swat.
  169.  *
  170.  * Revision 1.4  2000/01/24 20:40:43  roddey
  171.  * Exposed the APIs to get to the byte offset in the source XML buffer. This stuff
  172.  * is not tested yet, but I wanted to get the API changes in now so that the API
  173.  * can be stablized.
  174.  *
  175.  * Revision 1.3  2000/01/12 23:52:46  roddey
  176.  * These are trivial changes required to get the C++ and Java versions
  177.  * of error messages more into sync. Mostly it was where the Java version
  178.  * was passing out one or more parameter than the C++ version was. In
  179.  * some cases the change just required an extra parameter to get the
  180.  * needed info to the place where the error was issued.
  181.  *
  182.  * Revision 1.2  2000/01/12 00:15:04  roddey
  183.  * Changes to deal with multiply nested, relative pathed, entities and to deal
  184.  * with the new URL class changes.
  185.  *
  186.  * Revision 1.1.1.1  1999/11/09 01:08:23  twl
  187.  * Initial checkin
  188.  *
  189.  * Revision 1.4  1999/11/08 20:44:52  rahul
  190.  * Swat for adding in Product name and CVS comment log variable.
  191.  *
  192.  */
  193. #if !defined(XMLSCANNER_HPP)
  194. #define XMLSCANNER_HPP
  195. #include <util/KVStringPair.hpp>
  196. #include <util/RefVectorOf.hpp>
  197. #include <util/XMLString.hpp>
  198. #include <framework/XMLAttr.hpp>
  199. #include <framework/XMLBufferMgr.hpp>
  200. #include <framework/XMLErrorCodes.hpp>
  201. #include <framework/XMLRefInfo.hpp>
  202. #include <framework/XMLPScanToken.hpp>
  203. #include <internal/ElemStack.hpp>
  204. #include <internal/ReaderMgr.hpp>
  205. #include <validators/DTD/DTDEntityDecl.hpp>
  206. #include <validators/DTD/DTDValidator.hpp>
  207. #include <validators/schema/SchemaValidator.hpp>
  208. class InputSource;
  209. class XMLDocumentHandler;
  210. class DocTypeHandler;
  211. class XMLElementDecl;
  212. class XMLEntityHandler;
  213. class EntityResolver;
  214. class XMLErrorReporter;
  215. class ErrorHandler;
  216. class XMLMsgLoader;
  217. class XMLValidator;
  218. class ValueStoreCache;
  219. class XPathMatcherStack;
  220. class FieldActivator;
  221. class IdentityConstraint;
  222. //
  223. //  This is the mondo scanner class, which does the vast majority of the
  224. //  work of parsing. It handles reading in input and spitting out events
  225. //  to installed handlers.
  226. //
  227. class XMLPARSER_EXPORT XMLScanner
  228. {
  229. public :
  230.     // -----------------------------------------------------------------------
  231.     //  Public class types
  232.     //
  233.     //  NOTE: These should really be private, but some of the compilers we
  234.     //  have to deal with are too stupid to understand this.
  235.     //
  236.     //  DeclTypes
  237.     //      Used by scanXMLDecl() to know what type of decl it should scan.
  238.     //      Text decls have slightly different rules from XMLDecls.
  239.     //
  240.     //  EntityExpRes
  241.     //      These are the values returned from the entity expansion method,
  242.     //      to indicate how it went.
  243.     //
  244.     //  XMLTokens
  245.     //      These represent the possible types of input we can get while
  246.     //      scanning content.
  247.     //
  248.     //  ValScheme
  249.     //      This indicates what the scanner should do in terms of validation.
  250.     //      'Auto' means if there is any int/ext subset, then validate. Else,
  251.     //      don't.
  252.     // -----------------------------------------------------------------------
  253.     enum DeclTypes
  254.     {
  255.         Decl_Text
  256.         , Decl_XML
  257.     };
  258.     enum EntityExpRes
  259.     {
  260.         EntityExp_Pushed
  261.         , EntityExp_Returned
  262.         , EntityExp_Failed
  263.     };
  264.     enum XMLTokens
  265.     {
  266.         Token_CData
  267.         , Token_CharData
  268.         , Token_Comment
  269.         , Token_EndTag
  270.         , Token_EOF
  271.         , Token_PI
  272.         , Token_StartTag
  273.         , Token_Unknown
  274.     };
  275.     enum ValSchemes
  276.     {
  277.         Val_Never
  278.         , Val_Always
  279.         , Val_Auto
  280.     };
  281.     // -----------------------------------------------------------------------
  282.     //  Constructors and Destructor
  283.     // -----------------------------------------------------------------------
  284.     XMLScanner
  285.     (
  286.         XMLValidator* const valToAdopt
  287.     );
  288.     XMLScanner
  289.     (
  290.         XMLDocumentHandler* const  docHandler
  291.         , DocTypeHandler* const    docTypeHandler
  292.         , XMLEntityHandler* const  entityHandler
  293.         , XMLErrorReporter* const  errReporter
  294.         , XMLValidator* const      valToAdopt
  295.     );
  296.     ~XMLScanner();
  297.     // -----------------------------------------------------------------------
  298.     //  Error emitter methods
  299.     // -----------------------------------------------------------------------
  300.     void emitError(const XMLErrs::Codes toEmit);
  301.     void emitError
  302.     (
  303.         const   XMLErrs::Codes    toEmit
  304.         , const XMLCh* const        text1
  305.         , const XMLCh* const        text2 = 0
  306.         , const XMLCh* const        text3 = 0
  307.         , const XMLCh* const        text4 = 0
  308.     );
  309.     void emitError
  310.     (
  311.         const   XMLErrs::Codes    toEmit
  312.         , const char* const         text1
  313.         , const char* const         text2 = 0
  314.         , const char* const         text3 = 0
  315.         , const char* const         text4 = 0
  316.     );
  317.     // -----------------------------------------------------------------------
  318.     //  Getter methods
  319.     // -----------------------------------------------------------------------
  320.     const XMLDocumentHandler* getDocHandler() const;
  321.     XMLDocumentHandler* getDocHandler();
  322.     const DocTypeHandler* getDocTypeHandler() const;
  323.     DocTypeHandler* getDocTypeHandler();
  324.     bool getDoNamespaces() const;
  325.     ValSchemes getValidationScheme() const;
  326.     bool getDoSchema() const;
  327.     bool getValidationSchemaFullChecking() const;
  328.     const XMLEntityHandler* getEntityHandler() const;
  329.     XMLEntityHandler* getEntityHandler();
  330.     const XMLErrorReporter* getErrorReporter() const;
  331.     XMLErrorReporter* getErrorReporter();
  332.     bool getExitOnFirstFatal() const;
  333.     bool getValidationConstraintFatal() const;
  334.     RefHashTableOf<XMLRefInfo>* getIDRefList();
  335.     const RefHashTableOf<XMLRefInfo>* getIDRefList() const;
  336.     bool getInException() const;
  337.     bool getLastExtLocation
  338.     (
  339.                 XMLCh* const    sysIdToFill
  340.         , const unsigned int    maxSysIdChars
  341.         ,       XMLCh* const    pubIdToFill
  342.         , const unsigned int    maxPubIdChars
  343.         ,       unsigned int&   lineToFill
  344.         ,       unsigned int&   colToFill
  345.     );
  346.     const Locator* getLocator() const;
  347.     unsigned int getSrcOffset() const;
  348.     bool getStandalone() const;
  349.     const XMLValidator* getValidator() const;
  350.     XMLValidator* getValidator();
  351.     int getErrorCount();
  352.     const DTDEntityDecl* getEntityDecl
  353.     (
  354.         const   XMLCh* const    entName
  355.     )   const;
  356.     DTDEntityDecl* getEntityDecl
  357.     (
  358.         const   XMLCh* const    entName
  359.     );
  360.     NameIdPoolEnumerator<DTDEntityDecl> getEntityEnumerator() const;
  361.     NameIdPool<DTDEntityDecl>* getEntityDeclPool();
  362.     const NameIdPool<DTDEntityDecl>* getEntityDeclPool() const;
  363.     const XMLStringPool* getURIStringPool() const;
  364.     XMLStringPool* getURIStringPool();
  365.     bool getHasNoDTD() const;
  366.     XMLCh* getExternalSchemaLocation() const;
  367.     XMLCh* getExternalNoNamespaceSchemaLocation() const;
  368.     // -----------------------------------------------------------------------
  369.     //  Getter methods
  370.     // -----------------------------------------------------------------------
  371.     /**
  372.       * When an attribute name has no prefix, unlike elements, it is not mapped
  373.       * to the global namespace. So, in order to have something to map it to
  374.       * for practical purposes, a id for an empty URL is created and used for
  375.       * such names.
  376.       *
  377.       * @return The URL pool id of the URL for an empty URL "".
  378.       */
  379.     unsigned int getEmptyNamespaceId() const;
  380.     /**
  381.       * When a prefix is found that has not been mapped, an error is issued.
  382.       * However, if the parser has been instructed not to stop on the first
  383.       * fatal error, it needs to be able to continue. To do so, it will map
  384.       * that prefix tot his magic unknown namespace id.
  385.       *
  386.       * @return The URL pool id of the URL for the unknown prefix
  387.       *         namespace.
  388.       */
  389.     unsigned int getUnknownNamespaceId() const;
  390.     /**
  391.       * The prefix 'xml' is a magic prefix, defined by the XML spec and
  392.       * requiring no prior definition. This method returns the id for the
  393.       * intrinsically defined URL for this prefix.
  394.       *
  395.       * @return The URL pool id of the URL for the 'xml' prefix.
  396.       */
  397.     unsigned int getXMLNamespaceId() const;
  398.     /**
  399.       * The prefix 'xmlns' is a magic prefix, defined by the namespace spec
  400.       * and requiring no prior definition. This method returns the id for the
  401.       * intrinsically defined URL for this prefix.
  402.       *
  403.       * @return The URL pool id of the URL for the 'xmlns' prefix.
  404.       */
  405.     unsigned int getXMLNSNamespaceId() const;
  406.     /**
  407.       * This method find the passed URI id in its URI pool and
  408.       * copy the text of that URI into the passed buffer.
  409.       */
  410.     bool getURIText
  411.     (
  412.         const   unsigned int    uriId
  413.         ,       XMLBuffer&      uriBufToFill
  414.     )   const;
  415.     const XMLCh* getURIText(const   unsigned int    uriId) const;
  416.     /**
  417.       * This method separate the passed QName into prefix
  418.       * and local part, and then return the URI id by resolving
  419.       * the prefix.
  420.       *
  421.       * mode: Indicate if this QName comes from an Element or Attribute
  422.       */
  423.     unsigned int resolveQName
  424.     (
  425.         const   XMLCh* const        qName
  426.         ,       XMLBuffer&          nameBufToFill
  427.         ,       XMLBuffer&          prefixBufToFill
  428.         , const ElemStack::MapModes mode
  429.     );
  430.     /* tell if the validator comes from user */
  431.     bool isValidatorFromUser();
  432.     // -----------------------------------------------------------------------
  433.     //  Setter methods
  434.     // -----------------------------------------------------------------------
  435.     void setDocHandler(XMLDocumentHandler* const docHandler);
  436.     void setDocTypeHandler(DocTypeHandler* const docTypeHandler);
  437.     void setDoNamespaces(const bool doNamespaces);
  438.     void setEntityHandler(XMLEntityHandler* const docTypeHandler);
  439.     void setEntityResolver(EntityResolver* const handler);
  440.     void setErrorReporter(XMLErrorReporter* const errHandler);
  441.     void setErrorHandler(ErrorHandler* const handler);
  442.     void setExitOnFirstFatal(const bool newValue);
  443.     void setValidationConstraintFatal(const bool newValue);
  444.     void setValidationScheme(const ValSchemes newScheme);
  445.     void setValidator(XMLValidator* const valToAdopt);
  446.     void setDoSchema(const bool doSchema);
  447.     void setValidationSchemaFullChecking(const bool schemaFullChecking);
  448.     void setHasNoDTD(const bool hasNoDTD);
  449.     void setRootElemName(XMLCh* rootElemName);
  450.     void setExternalSchemaLocation(const XMLCh* const schemaLocation);
  451.     void setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation);
  452.     void setExternalSchemaLocation(const char* const schemaLocation);
  453.     void setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation);
  454.     // -----------------------------------------------------------------------
  455.     //  Mutator methods
  456.     // -----------------------------------------------------------------------
  457.     void incrementErrorCount(void); // For use by XMLValidator
  458.     // -----------------------------------------------------------------------
  459.     //  Deprecated methods as of 3.2.0. Use getValidationScheme() and
  460.     //  setValidationScheme() instead.
  461.     // -----------------------------------------------------------------------
  462.     bool getDoValidation() const;
  463.     void setDoValidation(const bool validate, const bool setValScheme = true);
  464.     // -----------------------------------------------------------------------
  465.     //  Document scanning methods
  466.     //
  467.     //  scanDocument() does the entire source document. scanFirst(),
  468.     //  scanNext(), and scanReset() support a progressive parse.
  469.     // -----------------------------------------------------------------------
  470.     void scanDocument
  471.     (
  472.         const   InputSource&    src
  473.         , const bool            reuseGrammar = false
  474.     );
  475.     void scanDocument
  476.     (
  477.         const   XMLCh* const    systemId
  478.         , const bool            reuseGrammar = false
  479.     );
  480.     void scanDocument
  481.     (
  482.         const   char* const     systemId
  483.         , const bool            reuseGrammar = false
  484.     );
  485.     bool scanFirst
  486.     (
  487.         const   InputSource&    src
  488.         ,       XMLPScanToken&  toFill
  489.         , const bool            reuseGrammar = false
  490.     );
  491.     bool scanFirst
  492.     (
  493.         const   XMLCh* const    systemId
  494.         ,       XMLPScanToken&  toFill
  495.         , const bool            reuseGrammar = false
  496.     );
  497.     bool scanFirst
  498.     (
  499.         const   char* const     systemId
  500.         ,       XMLPScanToken&  toFill
  501.         , const bool            reuseGrammar = false
  502.     );
  503.     bool scanNext(XMLPScanToken& toFill);
  504.     void scanReset(XMLPScanToken& toFill);
  505.     bool checkXMLDecl(bool startWithAngle);
  506.     // -----------------------------------------------------------------------
  507.     //  Notification that lazy data has been deleted
  508.     // -----------------------------------------------------------------------
  509. static void reinitScannerMutex();
  510. static void reinitMsgLoader();
  511. private :
  512.     // -----------------------------------------------------------------------
  513.     //  Unimplemented constructors and operators
  514.     // -----------------------------------------------------------------------
  515.     XMLScanner();
  516.     XMLScanner(const XMLScanner&);
  517.     void operator=(const XMLScanner&);
  518.     // -----------------------------------------------------------------------
  519.     //  Private helper methods
  520.     // -----------------------------------------------------------------------
  521.     void commonInit();
  522.     void initValidator(XMLValidator* theValidator);
  523.     void resetEntityDeclPool();
  524.     void resetURIStringPool();
  525.     // -----------------------------------------------------------------------
  526.     //  Private helper methods
  527.     //
  528.     //  These are implemented in XMLScanner2.cpp, to keep the main file from
  529.     //  becoming so bloated. We can't have any bloated files.
  530.     // -----------------------------------------------------------------------
  531.     unsigned int buildAttList
  532.     (
  533.         const   RefVectorOf<KVStringPair>&  providedAttrs
  534.         , const unsigned int                attCount
  535.         ,       XMLElementDecl*             elemDecl
  536.         ,       RefVectorOf<XMLAttr>&       toFill
  537.     );
  538.     void checkIDRefs();
  539.     bool isLegalToken(const XMLPScanToken& toCheck);
  540.     bool normalizeAttValue
  541.     (
  542.         const   XMLAttDef* const    attDef
  543.         , const XMLCh* const        value
  544.         ,       XMLBuffer&          toFill
  545.     );
  546.     bool normalizeAttRawValue
  547.     (
  548.         const   XMLCh* const        attrName
  549.         , const XMLCh* const        value
  550.         ,       XMLBuffer&          toFill
  551.     );
  552.     unsigned int resolvePrefix
  553.     (
  554.         const   XMLCh* const        prefix
  555.         , const ElemStack::MapModes mode
  556.     );
  557.     unsigned int resolvePrefix
  558.     (
  559.         const   XMLCh* const        prefix
  560.         ,       XMLBuffer&          uriBufToFill
  561.         , const ElemStack::MapModes mode
  562.     );
  563.     void scanReset(const InputSource& src);
  564.     void sendCharData(XMLBuffer& toSend);
  565.     XMLTokens senseNextToken(unsigned int& orgReader);
  566.     void updateNSMap
  567.     (
  568.         const   XMLCh* const    attrName
  569.         , const XMLCh* const    attrValue
  570.     );
  571.     void scanRawAttrListforNameSpaces(const RefVectorOf<KVStringPair>* theRawAttrList, int attCount);
  572.     void parseSchemaLocation(const XMLCh* const schemaLocationStr);
  573.     void resolveSchemaGrammar(const XMLCh* const loc, const XMLCh* const uri);
  574.     bool switchGrammar(unsigned int newGrammarNameSpaceIndex);
  575.     bool switchGrammar(const XMLCh* const newGrammarNameSpace);
  576.     bool laxElementValidation(QName* element, ContentLeafNameTypeVector* cv,
  577.                               const XMLContentModel* const cm,
  578.                               const unsigned int parentElemDepth);
  579.     bool anyAttributeValidation(SchemaAttDef* attWildCard,
  580.                                 unsigned int uriId,
  581.                                 bool& skipThisOne,
  582.                                 bool& laxThisOne);
  583.     // -----------------------------------------------------------------------
  584.     //  Private scanning methods
  585.     // -----------------------------------------------------------------------
  586.     bool basicAttrValueScan
  587.     (
  588.         const   XMLCh* const    attrName
  589.         ,       XMLBuffer&      toFill
  590.     );
  591.     bool getQuotedString(XMLBuffer& toFill);
  592.     unsigned int rawAttrScan
  593.     (
  594.         const   XMLCh* const                elemName
  595.         ,       RefVectorOf<KVStringPair>&  toFill
  596.         ,       bool&                       isEmpty
  597.     );
  598.     bool scanAttValue
  599.     (
  600.         const   XMLAttDef* const    attDef
  601.         ,       XMLBuffer&          toFill
  602.     );
  603.     void scanCDSection();
  604.     void scanCharData(XMLBuffer& toToUse);
  605.     bool scanCharRef(XMLCh& toFill, XMLCh& second);
  606.     void scanComment();
  607.     bool scanContent(const bool extEntity);
  608.     void scanEndTag(bool& gotData);
  609.     EntityExpRes scanEntityRef
  610.     (
  611.         const   bool    inAttVal
  612.         ,       XMLCh&  firstCh
  613.         ,       XMLCh&  secondCh
  614.         ,       bool&   escaped
  615.     );
  616.     bool scanEq();
  617.     void scanMiscellaneous();
  618.     void scanPI();
  619.     void scanProlog();
  620.     bool scanStartTag(bool& gotData);
  621.     bool scanStartTagNS(bool& gotData);
  622.     void scanXMLDecl(const DeclTypes type);
  623.     unsigned int scanUpToWSOr
  624.     (
  625.                 XMLBuffer&  toFill
  626.         , const XMLCh       chEndChar
  627.     );
  628.     // -----------------------------------------------------------------------
  629.     //  Private helper methods
  630.     // -----------------------------------------------------------------------
  631.     void resizeElemState();
  632.     // -----------------------------------------------------------------------
  633.     //  IdentityConstraints Activation methods
  634.     // -----------------------------------------------------------------------
  635.     void activateSelectorFor(IdentityConstraint* const ic);
  636.     // -----------------------------------------------------------------------
  637.     //  Data members
  638.     //
  639.     //  fAttrList
  640.     //      Every time we get a new element start tag, we have to pass to
  641.     //      the document handler the attributes found. To make it more
  642.     //      efficient we keep this ref vector of XMLAttr objects around. We
  643.     //      just reuse it over and over, allowing it to grow to meet the
  644.     //      peek need.
  645.     //
  646.     //  fBufMgr
  647.     //      This is a manager for temporary buffers used during scanning.
  648.     //      For efficiency we must use a set of static buffers, but we have
  649.     //      to insure that they are not incorrectly reused. So this manager
  650.     //      provides the smarts to hand out buffers as required.
  651.     //
  652.     //  fDocHandler
  653.     //      The client code's document handler. If zero, then no document
  654.     //      handler callouts are done. We don't adopt it.
  655.     //
  656.     //  fDocTypeHandler
  657.     //      The client code's document type handler (used by DTD Validator).
  658.     //
  659.     //  fDoNamespaces
  660.     //      This flag indicates whether the client code wants us to do
  661.     //      namespaces or not. If the installed validator indicates that it
  662.     //      has to do namespaces, then this is ignored.
  663.     //
  664.     //  fElemStack
  665.     //      This is the element stack that is used to track the elements that
  666.     //      are currently being worked on.
  667.     //
  668.     //  fEntityHandler
  669.     //      The client code's entity handler. If zero, then no entity handler
  670.     //      callouts are done. We don't adopt it.
  671.     //
  672.     //  fEntityResolver
  673.     //      The client code's entity resolver.  Need to store this info for
  674.     //      Schema parse entity resolving.
  675.     //
  676.     //  fErrorReporter
  677.     //      The client code's error reporter. If zero, then no error reporter
  678.     //      callouts are done. We don't adopt it.
  679.     //
  680.     //  fErrorHandler
  681.     //      The client code's error handler.  Need to store this info for
  682.     //      Schema parse error handling.
  683.     //
  684.     //  fExitOnFirstFatal
  685.     //      This indicates whether we bail out on the first fatal XML error
  686.     //      or not. It defaults to true, which is the strict XML way, but it
  687.     //      can be changed.
  688.     //
  689.     //  fValidationConstraintFatal
  690.     //      This indicates whether we treat validation constraint errors as
  691.     //      fatal errors or not. It defaults to false, but it can be changed.
  692.     //
  693.     //  fIDRefList
  694.     //      This is a list of XMLRefInfo objects. This member lets us do all
  695.     //      needed ID-IDREF balancing checks.
  696.     //
  697.     //  fInException
  698.     //      To avoid a circular freakout when we catch an exception and emit
  699.     //      it, which would normally throw again if the 'fail on first error'
  700.     //      flag is one.
  701.     //
  702.     //  fRawAttrList
  703.     //      During the initial scan of the attributes we can only do a raw
  704.     //      scan for key/value pairs. So this vector is used to store them
  705.     //      until they can be processed (and put into fAttrList.)
  706.     //
  707.     //  fReaderMgr
  708.     //      This is the reader manager, from which we get characters. It
  709.     //      manages the reader stack for us, and provides a lot of convenience
  710.     //      methods to do specialized checking for chars, sequences of chars,
  711.     //      skipping chars, etc...
  712.     //
  713.     //  fReuseGrammar
  714.     //      This flag is set on a per-scan basis. So its provided in the
  715.     //      scanDocument() and scanFirst() methods, and applies for that
  716.     //      one pass. It indicates if the Grammar should be reused or not.
  717.     //      If so, then all the Grammar will be ignored.
  718.     //      There cannot be any internal subset.
  719.     //
  720.     //  fScannerId
  721.     //  fSequenceId
  722.     //      These are used for progressive parsing, to make sure that the
  723.     //      client code does the right thing at the right time.
  724.     //
  725.     //  fStandalone
  726.     //      Indicates whether the document is standalone or not. Defaults to
  727.     //      no, but can be overridden in the XMLDecl.
  728.     //
  729.     //  fHasNoDTD
  730.     //      Indicates the document has no DTD or has only an internal DTD subset
  731.     //      which contains no parameter entity references.
  732.     //
  733.     //  fValidate
  734.     //      Indicates whether any validation should be done. This is defined
  735.     //      by the existence of a Grammar together with fValScheme.
  736.     //
  737.     //  fValidator
  738.     //      The installed validator. We look at them via the abstract
  739.     //      validator interface, and don't know what it actual is.
  740.     //      Either point to user's installed validator, or fDTDValidator
  741.     //      or fSchemaValidator.
  742.     //
  743.     //  fDTDValidator
  744.     //      The DTD validator instance.
  745.     //
  746.     //  fSchemaValidator
  747.     //      The Schema validator instance.
  748.     //
  749.     //  fValidatorFromUser
  750.     //      This flag indicates whether the validator was installed from
  751.     //      user.  If false, then the validator was created by the Scanner.
  752.     //
  753.     //  fValScheme
  754.     //      This is the currently set validation scheme. It defaults to
  755.     //      'never', but can be set by the client.
  756.     //
  757.     //  fErrorCount
  758.     // The number of errors we've encountered.
  759.     //
  760.     //  fDoSchema
  761.     //      This flag indicates whether the client code wants Schema to
  762.     //      be processed or not.
  763.     //
  764.     //  fSchemaFullChecking
  765.     //      This flag indicates whether the client code wants full Schema
  766.     //      constraint checking.
  767.     //
  768.     //  fSeeXsi
  769.     //      This flag indicates a schema has been seen.
  770.     //
  771.     //  fAttName
  772.     //  fAttValue
  773.     //  fCDataBuf
  774.     //  fNameBuf
  775.     //  fQNameBuf
  776.     //  fPrefixBuf
  777.     //      For the most part, buffers are obtained from the fBufMgr object
  778.     //      on the fly. However, for the start tag scan, we have a set of
  779.     //      fixed buffers for performance reasons. These are used a lot and
  780.     //      there are a number of them, so asking the buffer manager each
  781.     //      time for new buffers is a bit too much overhead.
  782.     //
  783.     //  fEmptyNamespaceId
  784.     //      This is the id of the empty namespace URI. This is a special one
  785.     //      because of the xmlns="" type of deal. We have to quickly sense
  786.     //      that its the empty namespace.
  787.     //
  788.     //  fUnknownNamespaceId
  789.     //      This is the id of the namespace URI which is assigned to the
  790.     //      global namespace. Its for debug purposes only, since there is no
  791.     //      real global namespace URI. Its set by the derived class.
  792.     //
  793.     //  fXMLNamespaceId
  794.     //  fXMLNSNamespaceId
  795.     //      These are the ids of the namespace URIs which are assigned to the
  796.     //      'xml' and 'xmlns' special prefixes. The former is officially
  797.     //      defined but the latter is not, so we just provide one for debug
  798.     //      purposes.
  799.     //
  800.     //  fSchemaNamespaceId
  801.     //      This is the id of the schema namespace URI.
  802.     //
  803.     //  fElemState
  804.     //  fElemStateSize
  805.     //      Stores an element next state from DFA content model - used for
  806.     //      wildcard validation
  807.     //
  808.     //  fGrammarResolver
  809.     //      Grammar Pool that stores all the Grammar
  810.     //
  811.     //  fGrammar
  812.     //      Current Grammar used by the Scanner and Validator
  813.     //
  814.     //  fGrammarType
  815.     //      Current Grammar Type.  Store this value instead of calling getGrammarType
  816.     //      all the time for faster performance.
  817.     //
  818.     //  fEntityDeclPool
  819.     //      This is a pool of EntityDecl objects, which contains all of the
  820.     //      general entities that are declared in the DTD subsets, plus the
  821.     //      default entities (such as &gt; &lt; ...) defined by the XML Standard.
  822.     //
  823.     //  fURIStringPool
  824.     //      This is a pool for URIs with unique ids assigned. We use a standard
  825.     //      string pool class.  This pool is going to be shared by all Grammar.
  826.     //      Use only if namespace is turned on.
  827.     //
  828.     //  fMatcherStack
  829.     //      Stack of active XPath matchers for identity constraints. All
  830.     //      active XPath matchers are notified of startElement, characters
  831.     //      and endElement callbacks in order to perform their matches.
  832.     //
  833.     //  fValueStoreCache
  834.     //      Cache of value stores for identity constraint fields.
  835.     //
  836.     //  fFieldActivator
  837.     //      Activates fields within a certain scope when a selector matches
  838.     //      its xpath.
  839.     //
  840.     //  fRootElemName
  841.     //      No matter we are using DTD or Schema Grammar, if a DOCTYPE exists,
  842.     //      we need to verify the root element name.  So store the rootElement
  843.     //      that is used in the DOCTYPE in the Scanner instead of in the DTDGrammar
  844.     //      where it used to
  845.     //
  846.     //  fExternalSchemaLocation
  847.     //      The list of Namespace/SchemaLocation that was specified externally
  848.     //      using setExternalSchemaLocation.
  849.     //
  850.     //  fExternalNoNamespaceSchemaLocation
  851.     //      The no target namespace XML Schema Location that was specified
  852.     //      externally using setExternalNoNamespaceSchemaLocation.
  853.     //
  854.     // -----------------------------------------------------------------------
  855.     bool                        fDoNamespaces;
  856.     bool                        fExitOnFirstFatal;
  857.     bool                        fValidationConstraintFatal;
  858.     bool                        fInException;
  859.     bool                        fReuseGrammar;
  860.     bool                        fStandalone;
  861.     bool                        fHasNoDTD;
  862.     bool                        fValidate;
  863.     bool                        fValidatorFromUser;
  864.     bool                        fDoSchema;
  865.     bool                        fSchemaFullChecking;
  866.     bool                        fSeeXsi;
  867.     int                         fErrorCount;
  868.     unsigned int                fEmptyNamespaceId;
  869.     unsigned int                fUnknownNamespaceId;
  870.     unsigned int                fXMLNamespaceId;
  871.     unsigned int                fXMLNSNamespaceId;
  872.     unsigned int                fSchemaNamespaceId;
  873.     unsigned int                fElemStateSize;
  874.     XMLUInt32                   fScannerId;
  875.     XMLUInt32                   fSequenceId;
  876.     unsigned int*               fElemState;
  877.     RefVectorOf<XMLAttr>*       fAttrList;
  878.     XMLBufferMgr                fBufMgr;
  879.     XMLDocumentHandler*         fDocHandler;
  880.     DocTypeHandler*             fDocTypeHandler;
  881.     ElemStack                   fElemStack;
  882.     XMLEntityHandler*           fEntityHandler;
  883.     EntityResolver*             fEntityResolver;
  884.     XMLErrorReporter*           fErrorReporter;
  885.     ErrorHandler*               fErrorHandler;
  886.     RefHashTableOf<XMLRefInfo>* fIDRefList;
  887.     RefVectorOf<KVStringPair>*  fRawAttrList;
  888.     ReaderMgr                   fReaderMgr;
  889.     XMLValidator*               fValidator;
  890.     DTDValidator*               fDTDValidator;
  891.     SchemaValidator*            fSchemaValidator;
  892.     ValSchemes                  fValScheme;
  893.     XMLBuffer                   fAttNameBuf;
  894.     XMLBuffer                   fAttValueBuf;
  895.     XMLBuffer                   fCDataBuf;
  896.     XMLBuffer                   fNameBuf;
  897.     XMLBuffer                   fQNameBuf;
  898.     XMLBuffer                   fPrefixBuf;
  899.     XMLBuffer                   fURIBuf;
  900.     GrammarResolver*            fGrammarResolver;
  901.     Grammar*                    fGrammar;
  902.     Grammar::GrammarType        fGrammarType;
  903.     NameIdPool<DTDEntityDecl>*  fEntityDeclPool;
  904.     XMLStringPool*              fURIStringPool;
  905.     XPathMatcherStack*          fMatcherStack;
  906.     ValueStoreCache*            fValueStoreCache;
  907.     FieldActivator*             fFieldActivator;
  908.     XMLCh*                      fRootElemName;
  909.     XMLCh*                      fExternalSchemaLocation;
  910.     XMLCh*                      fExternalNoNamespaceSchemaLocation;
  911. };
  912. // ---------------------------------------------------------------------------
  913. //  XMLScanner: Getter methods
  914. // ---------------------------------------------------------------------------
  915. inline const XMLDocumentHandler* XMLScanner::getDocHandler() const
  916. {
  917.     return fDocHandler;
  918. }
  919. inline XMLDocumentHandler* XMLScanner::getDocHandler()
  920. {
  921.     return fDocHandler;
  922. }
  923. inline const DocTypeHandler* XMLScanner::getDocTypeHandler() const
  924. {
  925.     return fDocTypeHandler;
  926. }
  927. inline DocTypeHandler* XMLScanner::getDocTypeHandler()
  928. {
  929.     return fDocTypeHandler;
  930. }
  931. inline bool XMLScanner::getDoNamespaces() const
  932. {
  933.     return fDoNamespaces;
  934. }
  935. inline const XMLEntityHandler* XMLScanner::getEntityHandler() const
  936. {
  937.     return fEntityHandler;
  938. }
  939. inline XMLEntityHandler* XMLScanner::getEntityHandler()
  940. {
  941.     return fEntityHandler;
  942. }
  943. inline const XMLErrorReporter* XMLScanner::getErrorReporter() const
  944. {
  945.     return fErrorReporter;
  946. }
  947. inline XMLErrorReporter* XMLScanner::getErrorReporter()
  948. {
  949.     return fErrorReporter;
  950. }
  951. inline bool XMLScanner::getExitOnFirstFatal() const
  952. {
  953.     return fExitOnFirstFatal;
  954. }
  955. inline bool XMLScanner::getValidationConstraintFatal() const
  956. {
  957.     return fValidationConstraintFatal;
  958. }
  959. inline RefHashTableOf<XMLRefInfo>* XMLScanner::getIDRefList()
  960. {
  961.     return fIDRefList;
  962. }
  963. inline bool XMLScanner::getInException() const
  964. {
  965.     return fInException;
  966. }
  967. inline const RefHashTableOf<XMLRefInfo>* XMLScanner::getIDRefList() const
  968. {
  969.     return fIDRefList;
  970. }
  971. inline const Locator* XMLScanner::getLocator() const
  972. {
  973.     return &fReaderMgr;
  974. }
  975. inline unsigned int XMLScanner::getSrcOffset() const
  976. {
  977.     return fReaderMgr.getSrcOffset();
  978. }
  979. inline bool XMLScanner::getStandalone() const
  980. {
  981.     return fStandalone;
  982. }
  983. inline XMLScanner::ValSchemes XMLScanner::getValidationScheme() const
  984. {
  985.     return fValScheme;
  986. }
  987. inline const XMLValidator* XMLScanner::getValidator() const
  988. {
  989.     return fValidator;
  990. }
  991. inline XMLValidator* XMLScanner::getValidator()
  992. {
  993.     return fValidator;
  994. }
  995. inline bool XMLScanner::getDoSchema() const
  996. {
  997.     return fDoSchema;
  998. }
  999. inline bool XMLScanner::getValidationSchemaFullChecking() const
  1000. {
  1001.     return fSchemaFullChecking;
  1002. }
  1003. inline int XMLScanner::getErrorCount()
  1004. {
  1005.     return fErrorCount;
  1006. }
  1007. inline bool XMLScanner::isValidatorFromUser()
  1008. {
  1009.     return fValidatorFromUser;
  1010. }
  1011. inline unsigned int XMLScanner::getEmptyNamespaceId() const
  1012. {
  1013.     return fEmptyNamespaceId;
  1014. }
  1015. inline unsigned int XMLScanner::getUnknownNamespaceId() const
  1016. {
  1017.     return fUnknownNamespaceId;
  1018. }
  1019. inline unsigned int XMLScanner::getXMLNamespaceId() const
  1020. {
  1021.     return fXMLNamespaceId;
  1022. }
  1023. inline unsigned int XMLScanner::getXMLNSNamespaceId() const
  1024. {
  1025.     return fXMLNSNamespaceId;
  1026. }
  1027. inline NameIdPoolEnumerator<DTDEntityDecl>
  1028. XMLScanner::getEntityEnumerator() const
  1029. {
  1030.     return NameIdPoolEnumerator<DTDEntityDecl>(fEntityDeclPool);
  1031. }
  1032. inline const DTDEntityDecl* XMLScanner::getEntityDecl(const  XMLCh* const    entName) const
  1033. {
  1034.     return fEntityDeclPool->getByKey(entName);
  1035. }
  1036. inline DTDEntityDecl* XMLScanner::getEntityDecl(const XMLCh* const entName)
  1037. {
  1038.     return fEntityDeclPool->getByKey(entName);
  1039. }
  1040. inline NameIdPool<DTDEntityDecl>* XMLScanner::getEntityDeclPool()
  1041. {
  1042.     return fEntityDeclPool;
  1043. }
  1044. inline const NameIdPool<DTDEntityDecl>* XMLScanner::getEntityDeclPool() const
  1045. {
  1046.     return fEntityDeclPool;
  1047. }
  1048. inline const XMLStringPool* XMLScanner::getURIStringPool() const
  1049. {
  1050.     return fURIStringPool;
  1051. }
  1052. inline XMLStringPool* XMLScanner::getURIStringPool()
  1053. {
  1054.     return fURIStringPool;
  1055. }
  1056. inline bool XMLScanner::getHasNoDTD() const
  1057. {
  1058.     return fHasNoDTD;
  1059. }
  1060. inline XMLCh* XMLScanner::getExternalSchemaLocation() const
  1061. {
  1062.     return fExternalSchemaLocation;
  1063. }
  1064. inline XMLCh* XMLScanner::getExternalNoNamespaceSchemaLocation() const
  1065. {
  1066.     return fExternalNoNamespaceSchemaLocation;
  1067. }
  1068. // ---------------------------------------------------------------------------
  1069. //  XMLScanner: Setter methods
  1070. // ---------------------------------------------------------------------------
  1071. inline void XMLScanner::setDocHandler(XMLDocumentHandler* const docHandler)
  1072. {
  1073.     fDocHandler = docHandler;
  1074. }
  1075. inline void XMLScanner::setDocTypeHandler(DocTypeHandler* const docTypeHandler)
  1076. {
  1077.     fDocTypeHandler = docTypeHandler;
  1078. }
  1079. inline void XMLScanner::setDoNamespaces(const bool doNamespaces)
  1080. {
  1081.     fDoNamespaces = doNamespaces;
  1082.     if (fDoNamespaces) {
  1083.         if (!fURIStringPool) {
  1084.             fURIStringPool = new XMLStringPool();
  1085.             resetURIStringPool();
  1086.         }
  1087.     }
  1088. }
  1089. inline void XMLScanner::setErrorReporter(XMLErrorReporter* const errHandler)
  1090. {
  1091.     fErrorReporter = errHandler;
  1092.     fDTDValidator->setErrorReporter(fErrorReporter);
  1093.     fSchemaValidator->setErrorReporter(fErrorReporter);
  1094. }
  1095. inline void XMLScanner::setErrorHandler(ErrorHandler* const handler)
  1096. {
  1097.     fErrorHandler = handler;
  1098. }
  1099. inline void XMLScanner::setEntityHandler(XMLEntityHandler* const entityHandler)
  1100. {
  1101.     fEntityHandler = entityHandler;
  1102.     fReaderMgr.setEntityHandler(entityHandler);
  1103. }
  1104. inline void XMLScanner::setEntityResolver(EntityResolver* const handler)
  1105. {
  1106.     fEntityResolver = handler;
  1107. }
  1108. inline void XMLScanner::setExitOnFirstFatal(const bool newValue)
  1109. {
  1110.     fExitOnFirstFatal = newValue;
  1111. }
  1112. inline void XMLScanner::setValidationConstraintFatal(const bool newValue)
  1113. {
  1114.     fValidationConstraintFatal = newValue;
  1115. }
  1116. inline void XMLScanner::setValidationScheme(const ValSchemes newScheme)
  1117. {
  1118.     fValScheme = newScheme;
  1119.     // validation flag for Val_Auto is set to false by default,
  1120.     //   and will be turned to true if a grammar is seen
  1121.     if (fValScheme == Val_Always)
  1122.         fValidate = true;
  1123.     else
  1124.         fValidate = false;
  1125. }
  1126. inline void XMLScanner::setValidator(XMLValidator* const valToAdopt)
  1127. {
  1128.     if (fValidatorFromUser)
  1129.         delete fValidator;
  1130.     fValidator = valToAdopt;
  1131.     fValidatorFromUser = true;
  1132.     initValidator(fValidator);
  1133. }
  1134. inline void XMLScanner::setDoSchema(const bool doSchema)
  1135. {
  1136.     fDoSchema = doSchema;
  1137. }
  1138. inline void XMLScanner::setValidationSchemaFullChecking(const bool schemaFullChecking)
  1139. {
  1140.     fSchemaFullChecking = schemaFullChecking;
  1141. }
  1142. inline void XMLScanner::setHasNoDTD(const bool hasNoDTD)
  1143. {
  1144.     fHasNoDTD = hasNoDTD;
  1145. }
  1146. inline void XMLScanner::setRootElemName(XMLCh* rootElemName)
  1147. {
  1148.     delete [] fRootElemName;
  1149.     fRootElemName = XMLString::replicate(rootElemName);
  1150. }
  1151. inline void XMLScanner::setExternalSchemaLocation(const XMLCh* const schemaLocation)
  1152. {
  1153.     delete [] fExternalSchemaLocation;
  1154.     fExternalSchemaLocation = XMLString::replicate(schemaLocation);
  1155. }
  1156. inline void XMLScanner::setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation)
  1157. {
  1158.     delete [] fExternalNoNamespaceSchemaLocation;
  1159.     fExternalNoNamespaceSchemaLocation = XMLString::replicate(noNamespaceSchemaLocation);
  1160. }
  1161. inline void XMLScanner::setExternalSchemaLocation(const char* const schemaLocation)
  1162. {
  1163.     delete [] fExternalSchemaLocation;
  1164.     fExternalSchemaLocation = XMLString::transcode(schemaLocation);
  1165. }
  1166. inline void XMLScanner::setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation)
  1167. {
  1168.     delete [] fExternalNoNamespaceSchemaLocation;
  1169.     fExternalNoNamespaceSchemaLocation = XMLString::transcode(noNamespaceSchemaLocation);
  1170. }
  1171. // ---------------------------------------------------------------------------
  1172. //  XMLScanner: Mutator methods
  1173. // ---------------------------------------------------------------------------
  1174. inline void XMLScanner::incrementErrorCount()
  1175. {
  1176.     ++fErrorCount;
  1177. }
  1178. // ---------------------------------------------------------------------------
  1179. //  XMLScanner: Deprecated methods
  1180. // ---------------------------------------------------------------------------
  1181. inline bool XMLScanner::getDoValidation() const
  1182. {
  1183.     return fValidate;
  1184. }
  1185. inline void XMLScanner::setDoValidation(const bool validate, const bool setValScheme)
  1186. {
  1187.     fValidate = validate;
  1188.     if (setValScheme) {
  1189.         if (fValidate)
  1190.             fValScheme = Val_Always;
  1191.         else
  1192.             fValScheme = Val_Never;
  1193.     }
  1194. }
  1195. #endif