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 706743 2008-10-21 20:05:27Z borisk $
00020  */
00021 
00022 #ifndef SAX2XMLReader_HPP
00023 #define 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 
00030 XERCES_CPP_NAMESPACE_BEGIN
00031 
00032 class ContentHandler ;
00033 class DTDHandler;
00034 class EntityResolver;
00035 class ErrorHandler;
00036 class InputSource;
00037 class LexicalHandler;
00038 class DeclHandler;
00039 class XMLDocumentHandler;
00040 class Grammar;
00041 
00042 class SAX2_EXPORT SAX2XMLReader
00043 {
00044 public:
00045     // -----------------------------------------------------------------------
00046     //  Class types
00047     // -----------------------------------------------------------------------
00050 
00058     enum ValSchemes
00059     {
00060         Val_Never
00061         , Val_Always
00062         , Val_Auto
00063     };
00065 
00066 
00067     // -----------------------------------------------------------------------
00068     //  Constructors and Destructor
00069     // -----------------------------------------------------------------------
00073     SAX2XMLReader()
00074     {
00075     }
00077     virtual ~SAX2XMLReader()
00078     {
00079     }
00081 
00082     //-----------------------------------------------------------------------
00083     // The XMLReader interface
00084     //-----------------------------------------------------------------------
00087 
00093     virtual ContentHandler* getContentHandler() const = 0 ;
00094 
00100     virtual DTDHandler* getDTDHandler() const = 0;
00101 
00107     virtual EntityResolver* getEntityResolver() const = 0 ;
00108 
00114     virtual ErrorHandler* getErrorHandler() const = 0 ;
00115 
00123     virtual bool getFeature(const XMLCh* const name) const = 0;
00124 
00144     virtual void* getProperty(const XMLCh* const name) const = 0 ;
00145 
00162     virtual void setContentHandler(ContentHandler* const handler) = 0;
00163 
00179     virtual void setDTDHandler(DTDHandler* const handler) = 0;
00180 
00197     virtual void setEntityResolver(EntityResolver* const resolver) = 0;
00198 
00216     virtual void setErrorHandler(ErrorHandler* const handler) = 0;
00217 
00241     virtual void setFeature(const XMLCh* const name, const bool value) = 0;
00242 
00266     virtual void setProperty(const XMLCh* const name, void* value) = 0 ;
00267 
00293     virtual void parse
00294     (
00295         const   InputSource&    source
00296     ) = 0;
00297 
00317     virtual void parse
00318     (
00319         const   XMLCh* const    systemId
00320     ) = 0;
00321 
00341     virtual void parse
00342     (
00343         const   char* const     systemId
00344     ) = 0;
00345     
00347 
00348     // -----------------------------------------------------------------------
00349     //  SAX 2.0-ext
00350     // -----------------------------------------------------------------------
00358     virtual DeclHandler* getDeclarationHandler() const = 0 ;
00359 
00365     virtual LexicalHandler* getLexicalHandler() const = 0 ;
00366 
00383     virtual void setDeclarationHandler(DeclHandler* const handler) = 0;
00384 
00401     virtual void setLexicalHandler(LexicalHandler* const handler) = 0;
00402 
00404 
00405     // -----------------------------------------------------------------------
00406     //  Getter Methods
00407     // -----------------------------------------------------------------------
00420     virtual XMLValidator* getValidator() const = 0;
00421 
00432     virtual int getErrorCount() const = 0 ;
00433 
00447     virtual bool getExitOnFirstFatalError() const = 0;
00448 
00463     virtual bool getValidationConstraintFatal() const = 0;
00464 
00471     virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey) = 0;
00472 
00478     virtual Grammar* getRootGrammar() = 0;
00479 
00486     virtual const XMLCh* getURIText(unsigned int uriId) const = 0;
00487 
00494     virtual unsigned int getSrcOffset() const = 0;
00495 
00497 
00498     // -----------------------------------------------------------------------
00499     //  Setter Methods
00500     // -----------------------------------------------------------------------
00512     virtual void setValidator(XMLValidator* valueToAdopt) = 0;
00513 
00535     virtual void setExitOnFirstFatalError(const bool newState) = 0;
00536 
00562     virtual void setValidationConstraintFatal(const bool newState) = 0;
00564 
00565 
00566     // -----------------------------------------------------------------------
00567     //  Progressive scan methods
00568     // -----------------------------------------------------------------------
00569 
00572 
00600     virtual bool parseFirst
00601     (
00602         const   XMLCh* const    systemId
00603         ,       XMLPScanToken&  toFill
00604     ) = 0;
00605 
00633     virtual bool parseFirst
00634     (
00635         const   char* const     systemId
00636         ,       XMLPScanToken&  toFill
00637     ) = 0;
00638 
00666     virtual bool parseFirst
00667     (
00668         const   InputSource&    source
00669         ,       XMLPScanToken&  toFill
00670     ) = 0;
00671 
00696     virtual bool parseNext(XMLPScanToken& token) = 0;
00697 
00719     virtual void parseReset(XMLPScanToken& token) = 0;
00720 
00722 
00723     // -----------------------------------------------------------------------
00724     //  Grammar preparsing interface
00725     // -----------------------------------------------------------------------
00726 
00756     virtual Grammar* loadGrammar(const InputSource& source,
00757                                  const short grammarType,
00758                                  const bool toCache = false) = 0;
00759 
00785     virtual Grammar* loadGrammar(const XMLCh* const systemId,
00786                                  const short grammarType,
00787                                  const bool toCache = false) = 0;
00788 
00813     virtual Grammar* loadGrammar(const char* const systemId,
00814                                  const short grammarType,
00815                                  const bool toCache = false) = 0;
00816 
00820     virtual void resetCachedGrammarPool() = 0;
00821 
00832     virtual void setInputBufferSize(const size_t bufferSize);
00833 
00835 
00836 
00837     // -----------------------------------------------------------------------
00838     //  Advanced document handler list maintenance methods
00839     // -----------------------------------------------------------------------
00840 
00856     virtual void installAdvDocHandler(XMLDocumentHandler* const toInstall) = 0;
00857 
00867     virtual bool removeAdvDocHandler(XMLDocumentHandler* const toRemove) = 0;
00869 
00870 private :
00871     /* The copy constructor, you cannot call this directly */
00872     SAX2XMLReader(const SAX2XMLReader&);
00873 
00874     /* The assignment operator, you cannot call this directly */
00875     SAX2XMLReader& operator=(const SAX2XMLReader&);
00876 
00877 };
00878 
00879 inline void SAX2XMLReader::setInputBufferSize(const size_t /*bufferSize*/) 
00880 {
00881 }
00882 
00883 XERCES_CPP_NAMESPACE_END
00884 
00885 #endif

Generated on Thu Feb 19 11:35:43 2009 for Xerces-C++ by  doxygen 1.5.4