Xerces-C++: SAX2XMLReader.hpp Source File

- Main Page
- Related Pages
- Classes
- Files

# 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 932887 2010-04-11 13:04:59Z 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
    00155     virtual void* getProperty(const XMLCh* const name) const = 0 ;
    00156
    00173     virtual void setContentHandler(ContentHandler* const handler) = 0;
    00174
    00190     virtual void setDTDHandler(DTDHandler* const handler) = 0;
    00191
    00208     virtual void setEntityResolver(EntityResolver* const resolver) = 0;
    00209
    00227     virtual void setErrorHandler(ErrorHandler* const handler) = 0;
    00228
    00252     virtual void setFeature(const XMLCh* const name, const bool value) = 0;
    00253
    00277     virtual void setProperty(const XMLCh* const name, void* value) = 0 ;
    00278
    00304     virtual void parse
    00305     (
    00306         const   InputSource&    source
    00307     ) = 0;
    00308
    00328     virtual void parse
    00329     (
    00330         const   XMLCh* const    systemId
    00331     ) = 0;
    00332
    00352     virtual void parse
    00353     (
    00354         const   char* const     systemId
    00355     ) = 0;
    00356
    00358
    00359     // -----------------------------------------------------------------------
    00360     //  SAX 2.0-ext
    00361     // -----------------------------------------------------------------------
    00369     virtual DeclHandler* getDeclarationHandler() const = 0 ;
    00370
    00376     virtual LexicalHandler* getLexicalHandler() const = 0 ;
    00377
    00394     virtual void setDeclarationHandler(DeclHandler* const handler) = 0;
    00395
    00412     virtual void setLexicalHandler(LexicalHandler* const handler) = 0;
    00413
    00415
    00416     // -----------------------------------------------------------------------
    00417     //  Getter Methods
    00418     // -----------------------------------------------------------------------
    00431     virtual XMLValidator* getValidator() const = 0;
    00432
    00443     virtual XMLSize_t getErrorCount() const = 0 ;
    00444
    00458     virtual bool getExitOnFirstFatalError() const = 0;
    00459
    00474     virtual bool getValidationConstraintFatal() const = 0;
    00475
    00482     virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey) = 0;
    00483
    00489     virtual Grammar* getRootGrammar() = 0;
    00490
    00497     virtual const XMLCh* getURIText(unsigned int uriId) const = 0;
    00498
    00505     virtual XMLFilePos getSrcOffset() const = 0;
    00506
    00508
    00509     // -----------------------------------------------------------------------
    00510     //  Setter Methods
    00511     // -----------------------------------------------------------------------
    00523     virtual void setValidator(XMLValidator* valueToAdopt) = 0;
    00524
    00546     virtual void setExitOnFirstFatalError(const bool newState) = 0;
    00547
    00573     virtual void setValidationConstraintFatal(const bool newState) = 0;
    00575
    00576
    00577     // -----------------------------------------------------------------------
    00578     //  Progressive scan methods
    00579     // -----------------------------------------------------------------------
    00580
    00583
    00611     virtual bool parseFirst
    00612     (
    00613         const   XMLCh* const    systemId
    00614         ,       XMLPScanToken&  toFill
    00615     ) = 0;
    00616
    00644     virtual bool parseFirst
    00645     (
    00646         const   char* const     systemId
    00647         ,       XMLPScanToken&  toFill
    00648     ) = 0;
    00649
    00677     virtual bool parseFirst
    00678     (
    00679         const   InputSource&    source
    00680         ,       XMLPScanToken&  toFill
    00681     ) = 0;
    00682
    00707     virtual bool parseNext(XMLPScanToken& token) = 0;
    00708
    00730     virtual void parseReset(XMLPScanToken& token) = 0;
    00731
    00733
    00734     // -----------------------------------------------------------------------
    00735     //  Grammar preparsing interface
    00736     // -----------------------------------------------------------------------
    00737
    00766     virtual Grammar* loadGrammar(const InputSource& source,
    00767                                  const Grammar::GrammarType grammarType,
    00768                                  const bool toCache = false) = 0;
    00769
    00794     virtual Grammar* loadGrammar(const XMLCh* const systemId,
    00795                                  const Grammar::GrammarType grammarType,
    00796                                  const bool toCache = false) = 0;
    00797
    00821     virtual Grammar* loadGrammar(const char* const systemId,
    00822                                  const Grammar::GrammarType grammarType,
    00823                                  const bool toCache = false) = 0;
    00824
    00828     virtual void resetCachedGrammarPool() = 0;
    00829
    00840     virtual void setInputBufferSize(const XMLSize_t bufferSize);
    00841
    00843
    00844
    00845     // -----------------------------------------------------------------------
    00846     //  Advanced document handler list maintenance methods
    00847     // -----------------------------------------------------------------------
    00848
    00864     virtual void installAdvDocHandler(XMLDocumentHandler* const toInstall) = 0;
    00865
    00875     virtual bool removeAdvDocHandler(XMLDocumentHandler* const toRemove) = 0;
    00877
    00878 private :
    00879     /* The copy constructor, you cannot call this directly */
    00880     SAX2XMLReader(const SAX2XMLReader&);
    00881
    00882     /* The assignment operator, you cannot call this directly */
    00883     SAX2XMLReader& operator=(const SAX2XMLReader&);
    00884
    00885 };
    00886
    00887 inline void SAX2XMLReader::setInputBufferSize(const XMLSize_t /*bufferSize*/)
    00888 {
    00889 }
    00890
    00891 XERCES_CPP_NAMESPACE_END
    00892
    00893 #endif