secureswitools/swisistools/source/xmlparser/xerces/include/xercesc/internal/WFXMLScanner.hpp
changeset 5 3eebb1e54d3a
parent 3 127731b7107d
child 6 aba6b8104af3
equal deleted inserted replaced
3:127731b7107d 5:3eebb1e54d3a
     1 /*
       
     2  * Licensed to the Apache Software Foundation (ASF) under one or more
       
     3  * contributor license agreements.  See the NOTICE file distributed with
       
     4  * this work for additional information regarding copyright ownership.
       
     5  * The ASF licenses this file to You under the Apache License, Version 2.0
       
     6  * (the "License"); you may not use this file except in compliance with
       
     7  * the License.  You may obtain a copy of the License at
       
     8  * 
       
     9  *      http://www.apache.org/licenses/LICENSE-2.0
       
    10  * 
       
    11  * Unless required by applicable law or agreed to in writing, software
       
    12  * distributed under the License is distributed on an "AS IS" BASIS,
       
    13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    14  * See the License for the specific language governing permissions and
       
    15  * limitations under the License.
       
    16  */
       
    17 
       
    18 /*
       
    19  * $Id: WFXMLScanner.hpp 568078 2007-08-21 11:43:25Z amassari $
       
    20  */
       
    21 
       
    22 
       
    23 #if !defined(WFXMLSCANNER_HPP)
       
    24 #define WFXMLSCANNER_HPP
       
    25 
       
    26 #include <xercesc/internal/XMLScanner.hpp>
       
    27 #include <xercesc/util/ValueHashTableOf.hpp>
       
    28 #include <xercesc/util/ValueVectorOf.hpp>
       
    29 #include <xercesc/validators/DTD/DTDElementDecl.hpp>
       
    30 
       
    31 XERCES_CPP_NAMESPACE_BEGIN
       
    32 
       
    33 
       
    34 //  This is a a non-validating scanner. No DOCTYPE or XML Schema processing
       
    35 //  will take place.
       
    36 class XMLPARSER_EXPORT WFXMLScanner : public XMLScanner
       
    37 {
       
    38 public :
       
    39     // -----------------------------------------------------------------------
       
    40     //  Constructors and Destructor
       
    41     // -----------------------------------------------------------------------
       
    42     WFXMLScanner
       
    43     (
       
    44         XMLValidator* const       valToAdopt
       
    45         , GrammarResolver* const  grammarResolver
       
    46         , MemoryManager* const    manager = XMLPlatformUtils::fgMemoryManager
       
    47     );
       
    48     WFXMLScanner
       
    49     (
       
    50         XMLDocumentHandler* const docHandler
       
    51         , DocTypeHandler* const   docTypeHandler
       
    52         , XMLEntityHandler* const entityHandler
       
    53         , XMLErrorReporter* const errReporter
       
    54         , XMLValidator* const     valToAdopt
       
    55         , GrammarResolver* const  grammarResolver
       
    56         , MemoryManager* const    manager = XMLPlatformUtils::fgMemoryManager
       
    57     );
       
    58     virtual ~WFXMLScanner();
       
    59 
       
    60     // -----------------------------------------------------------------------
       
    61     //  XMLScanner public virtual methods
       
    62     // -----------------------------------------------------------------------
       
    63     virtual const XMLCh* getName() const;
       
    64     virtual NameIdPool<DTDEntityDecl>* getEntityDeclPool();
       
    65     virtual const NameIdPool<DTDEntityDecl>* getEntityDeclPool() const;
       
    66     virtual unsigned int resolveQName
       
    67     (
       
    68         const   XMLCh* const        qName
       
    69         ,       XMLBuffer&          prefixBufToFill
       
    70         , const short               mode
       
    71         ,       int&                prefixColonPos
       
    72     );
       
    73     virtual void scanDocument
       
    74     (
       
    75         const   InputSource&    src
       
    76     );
       
    77     virtual bool scanNext(XMLPScanToken& toFill);
       
    78     virtual Grammar* loadGrammar
       
    79     (
       
    80         const   InputSource&    src
       
    81         , const short           grammarType
       
    82         , const bool            toCache = false
       
    83     );
       
    84 
       
    85 private :
       
    86     // -----------------------------------------------------------------------
       
    87     //  Unimplemented constructors and operators
       
    88     // -----------------------------------------------------------------------
       
    89     WFXMLScanner();
       
    90     WFXMLScanner(const WFXMLScanner&);
       
    91     WFXMLScanner& operator=(const WFXMLScanner&);
       
    92 
       
    93     // -----------------------------------------------------------------------
       
    94     //  XMLScanner virtual methods
       
    95     // -----------------------------------------------------------------------
       
    96     virtual void scanCDSection();
       
    97     virtual void scanCharData(XMLBuffer& toToUse);
       
    98     virtual EntityExpRes scanEntityRef
       
    99     (
       
   100         const   bool    inAttVal
       
   101         ,       XMLCh&  firstCh
       
   102         ,       XMLCh&  secondCh
       
   103         ,       bool&   escaped
       
   104     );
       
   105     virtual void scanDocTypeDecl();
       
   106     virtual void scanReset(const InputSource& src);
       
   107     virtual void sendCharData(XMLBuffer& toSend);
       
   108     virtual InputSource* resolveSystemId(const XMLCh* const sysId
       
   109                                         ,const XMLCh* const pubId);
       
   110 
       
   111     // -----------------------------------------------------------------------
       
   112     //  Private helper methods
       
   113     // -----------------------------------------------------------------------
       
   114     void commonInit();
       
   115     void cleanUp();
       
   116     unsigned int resolvePrefix
       
   117     (
       
   118         const   XMLCh* const        prefix
       
   119         , const ElemStack::MapModes mode
       
   120     );
       
   121 
       
   122     // -----------------------------------------------------------------------
       
   123     //  Private scanning methods
       
   124     // -----------------------------------------------------------------------
       
   125     bool scanAttValue
       
   126     (
       
   127         const   XMLCh* const    attrName
       
   128         ,       XMLBuffer&      toFill
       
   129     );
       
   130     bool scanContent();
       
   131     void scanEndTag(bool& gotData);
       
   132     bool scanStartTag(bool& gotData);
       
   133     bool scanStartTagNS(bool& gotData);
       
   134 
       
   135     // -----------------------------------------------------------------------
       
   136     //  Data members
       
   137     //
       
   138     //  fEntityTable
       
   139     //      This the table that contains the default entity entries.
       
   140     //
       
   141     //  fAttrNameHashList
       
   142     //      This contains the hash value for attribute names. It's used when
       
   143     //      checking for duplicate attributes.
       
   144     //
       
   145     //  fAttrNSList
       
   146     //      This contains XMLAttr objects that we need to map their prefixes
       
   147     //      to URIs when namespace is enabled.
       
   148     //
       
   149     // -----------------------------------------------------------------------
       
   150     unsigned int                       fElementIndex;
       
   151     RefVectorOf<XMLElementDecl>*       fElements;
       
   152     ValueHashTableOf<XMLCh>*           fEntityTable;
       
   153     ValueVectorOf<unsigned int>*       fAttrNameHashList;
       
   154     ValueVectorOf<XMLAttr*>*           fAttrNSList;
       
   155     RefHashTableOf<XMLElementDecl>*    fElementLookup;  
       
   156 };
       
   157 
       
   158 inline const XMLCh* WFXMLScanner::getName() const
       
   159 {
       
   160     return XMLUni::fgWFXMLScanner;
       
   161 }
       
   162 
       
   163 
       
   164 XERCES_CPP_NAMESPACE_END
       
   165 
       
   166 #endif