Xerces-C++: SAX2XMLReader.hpp Source File

- Main Page
- Classes
- Files
- Related Pages

# SAX2XMLReader.hpp

Go to the documentation of this file.

    00001 /*
    00002  * Licensed to the Apache Software Foundation (ASF) under one or more
    00003  * contributor license agreements.  See the NOTICE file distributed with
    00004  * this work for additional information regarding copyright ownership.
    00005  * The ASF licenses this file to You under the Apache License, Version 2.0
    00006  * (the "License"); you may not use this file except in compliance with
    00007  * the License.  You may obtain a copy of the License at
    00008  *
    00009  *      http://www.apache.org/licenses/LICENSE-2.0
    00010  *
    00011  * Unless required by applicable law or agreed to in writing, software
    00012  * distributed under the License is distributed on an "AS IS" BASIS,
    00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00014  * See the License for the specific language governing permissions and
    00015  * limitations under the License.
    00016  */
    00017
    00018 /*
    00019  * $Id: SAX2XMLReader.hpp 706747 2008-10-21 20:08:34Z borisk $
    00020  */
    00021
    00022 #if !defined(XERCESC_INCLUDE_GUARD_SAX2XMLREADER_HPP)
    00023 #define XERCESC_INCLUDE_GUARD_SAX2XMLREADER_HPP
    00024
    00025 #include <xercesc/util/XercesDefs.hpp>
    00026 #include <xercesc/util/XMLUniDefs.hpp>
    00027 #include <xercesc/framework/XMLValidator.hpp>
    00028 #include <xercesc/framework/XMLPScanToken.hpp>
    00029 #include <xercesc/validators/common/Grammar.hpp>
    00030
    00031 XERCES_CPP_NAMESPACE_BEGIN
    00032
    00033 class ContentHandler ;
    00034 class DTDHandler;
    00035 class EntityResolver;
    00036 class ErrorHandler;
    00037 class InputSource;
    00038 class LexicalHandler;
    00039 class DeclHandler;
    00040 class XMLDocumentHandler;
    00041
    00042 class SAX2_EXPORT SAX2XMLReader
    00043 {
    00044 public:
    00045     // -----------------------------------------------------------------------
    00046     //  Class types
    00047     // -----------------------------------------------------------------------
    00050
    00070     enum ValSchemes
    00071     {
    00072         Val_Never
    00073         , Val_Always
    00074         , Val_Auto
    00075     };
    00077
    00078
    00079     // -----------------------------------------------------------------------
    00080     //  Constructors and Destructor
    00081     // -----------------------------------------------------------------------
    00085     SAX2XMLReader()
    00086     {
    00087     }
    00089     virtual ~SAX2XMLReader()
    00090     {
    00091     }
    00093
    00094     //-----------------------------------------------------------------------
    00095     // The XMLReader interface
    00096     //-----------------------------------------------------------------------
    00099
    00105     virtual ContentHandler* getContentHandler() const = 0 ;
    00106
    00112     virtual DTDHandler* getDTDHandler() const = 0;
    00113
    00119     virtual EntityResolver* getEntityResolver() const = 0 ;
    00120
    00126     virtual ErrorHandler* getErrorHandler() const = 0 ;
    00127
    00135     virtual bool getFeature(const XMLCh* const name) const = 0;
    00136
    00156     virtual void* getProperty(const XMLCh* const name) const = 0 ;
    00157
    00174     virtual void setContentHandler(ContentHandler* const handler) = 0;
    00175
    00191     virtual void setDTDHandler(DTDHandler* const handler) = 0;
    00192
    00209     virtual void setEntityResolver(EntityResolver* const resolver) = 0;
    00210
    00228     virtual void setErrorHandler(ErrorHandler* const handler) = 0;
    00229
    00253     virtual void setFeature(const XMLCh* const name, const bool value) = 0;
    00254
    00278     virtual void setProperty(const XMLCh* const name, void* value) = 0 ;
    00279
    00305     virtual void parse
    00306     (
    00307         const   InputSource&    source
    00308     ) = 0;
    00309
    00329     virtual void parse
    00330     (
    00331         const   XMLCh* const    systemId
    00332     ) = 0;
    00333
    00353     virtual void parse
    00354     (
    00355         const   char* const     systemId
    00356     ) = 0;
    00357
    00359
    00360     // -----------------------------------------------------------------------
    00361     //  SAX 2.0-ext
    00362     // -----------------------------------------------------------------------
    00370     virtual DeclHandler* getDeclarationHandler() const = 0 ;
    00371
    00377     virtual LexicalHandler* getLexicalHandler() const = 0 ;
    00378
    00395     virtual void setDeclarationHandler(DeclHandler* const handler) = 0;
    00396
    00413     virtual void setLexicalHandler(LexicalHandler* const handler) = 0;
    00414
    00416
    00417     // -----------------------------------------------------------------------
    00418     //  Getter Methods
    00419     // -----------------------------------------------------------------------
    00432     virtual XMLValidator* getValidator() const = 0;
    00433
    00444     virtual XMLSize_t getErrorCount() const = 0 ;
    00445
    00459     virtual bool getExitOnFirstFatalError() const = 0;
    00460
    00475     virtual bool getValidationConstraintFatal() const = 0;
    00476
    00483     virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey) = 0;
    00484
    00490     virtual Grammar* getRootGrammar() = 0;
    00491
    00498     virtual const XMLCh* getURIText(unsigned int uriId) const = 0;
    00499
    00506     virtual XMLFilePos getSrcOffset() const = 0;
    00507
    00509
    00510     // -----------------------------------------------------------------------
    00511     //  Setter Methods
    00512     // -----------------------------------------------------------------------
    00524     virtual void setValidator(XMLValidator* valueToAdopt) = 0;
    00525
    00547     virtual void setExitOnFirstFatalError(const bool newState) = 0;
    00548
    00574     virtual void setValidationConstraintFatal(const bool newState) = 0;
    00576
    00577
    00578     // -----------------------------------------------------------------------
    00579     //  Progressive scan methods
    00580     // -----------------------------------------------------------------------
    00581
    00584
    00612     virtual bool parseFirst
    00613     (
    00614         const   XMLCh* const    systemId
    00615         ,       XMLPScanToken&  toFill
    00616     ) = 0;
    00617
    00645     virtual bool parseFirst
    00646     (
    00647         const   char* const     systemId
    00648         ,       XMLPScanToken&  toFill
    00649     ) = 0;
    00650
    00678     virtual bool parseFirst
    00679     (
    00680         const   InputSource&    source
    00681         ,       XMLPScanToken&  toFill
    00682     ) = 0;
    00683
    00708     virtual bool parseNext(XMLPScanToken& token) = 0;
    00709
    00731     virtual void parseReset(XMLPScanToken& token) = 0;
    00732
    00734
    00735     // -----------------------------------------------------------------------
    00736     //  Grammar preparsing interface
    00737     // -----------------------------------------------------------------------
    00738
    00768     virtual Grammar* loadGrammar(const InputSource& source,
    00769                                  const Grammar::GrammarType grammarType,
    00770                                  const bool toCache = false) = 0;
    00771
    00797     virtual Grammar* loadGrammar(const XMLCh* const systemId,
    00798                                  const Grammar::GrammarType grammarType,
    00799                                  const bool toCache = false) = 0;
    00800
    00825     virtual Grammar* loadGrammar(const char* const systemId,
    00826                                  const Grammar::GrammarType grammarType,
    00827                                  const bool toCache = false) = 0;
    00828
    00832     virtual void resetCachedGrammarPool() = 0;
    00833
    00844     virtual void setInputBufferSize(const XMLSize_t bufferSize);
    00845
    00847
    00848
    00849     // -----------------------------------------------------------------------
    00850     //  Advanced document handler list maintenance methods
    00851     // -----------------------------------------------------------------------
    00852
    00868     virtual void installAdvDocHandler(XMLDocumentHandler* const toInstall) = 0;
    00869
    00879     virtual bool removeAdvDocHandler(XMLDocumentHandler* const toRemove) = 0;
    00881
    00882 private :
    00883     /* The copy constructor, you cannot call this directly */
    00884     SAX2XMLReader(const SAX2XMLReader&);
    00885
    00886     /* The assignment operator, you cannot call this directly */
    00887     SAX2XMLReader& operator=(const SAX2XMLReader&);
    00888
    00889 };
    00890
    00891 inline void SAX2XMLReader::setInputBufferSize(const XMLSize_t /*bufferSize*/)
    00892 {
    00893 }
    00894
    00895 XERCES_CPP_NAMESPACE_END
    00896
    00897 #endif