Main Page   Class Hierarchy   Compound List   File List   Compound Members  

SAX2XMLReader.hpp

00001 /*
00002  * The Apache Software License, Version 1.1
00003  *
00004  * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
00005  * reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  *
00014  * 2. Redistributions in binary form must reproduce the above copyright
00015  *    notice, this list of conditions and the following disclaimer in
00016  *    the documentation and/or other materials provided with the
00017  *    distribution.
00018  *
00019  * 3. The end-user documentation included with the redistribution,
00020  *    if any, must include the following acknowledgment:
00021  *       "This product includes software developed by the
00022  *        Apache Software Foundation (http://www.apache.org/)."
00023  *    Alternately, this acknowledgment may appear in the software itself,
00024  *    if and wherever such third-party acknowledgments normally appear.
00025  *
00026  * 4. The names "Xerces" and "Apache Software Foundation" must
00027  *    not be used to endorse or promote products derived from this
00028  *    software without prior written permission. For written
00029  *    permission, please contact apache\@apache.org.
00030  *
00031  * 5. Products derived from this software may not be called "Apache",
00032  *    nor may "Apache" appear in their name, without prior written
00033  *    permission of the Apache Software Foundation.
00034  *
00035  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00036  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00037  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00038  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
00039  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00040  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00041  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00042  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00043  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00044  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00045  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00046  * SUCH DAMAGE.
00047  * ====================================================================
00048  *
00049  * This software consists of voluntary contributions made by many
00050  * individuals on behalf of the Apache Software Foundation, and was
00051  * originally based on software copyright (c) 1999, International
00052  * Business Machines, Inc., http://www.ibm.com .  For more information
00053  * on the Apache Software Foundation, please see
00054  * <http://www.apache.org/>.
00055  */
00056 
00057 /*
00058  * $Log: SAX2XMLReader.hpp,v $
00059  * Revision 1.1  2002/05/11 20:25:10  bhavani
00060  * CR#CR062582# adding xercesc 1.7 file
00061  *
00062  * Revision 1.1.1.1  2002/02/01 22:22:09  peiyongz
00063  * sane_include
00064  *
00065  * Revision 1.18  2002/01/28 18:45:40  knoaman
00066  * Update documentation for SAX2 feature 'namespace-prefixes'.
00067  *
00068  * Revision 1.17  2002/01/28 17:08:33  knoaman
00069  * SAX2-ext's DeclHandler support.
00070  *
00071  * Revision 1.16  2002/01/18 16:31:26  tng
00072  * Break program.xml which takes too long to load, into program-sax.xml, program-sax2.xml, program-dom.xml, program-idom.xml.
00073  *
00074  * Revision 1.15  2002/01/02 15:36:54  tng
00075  * Some documentation update.
00076  *
00077  * Revision 1.14  2001/11/20 18:51:44  tng
00078  * 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).
00079  *
00080  * Revision 1.13  2001/11/14 14:15:59  tng
00081  * Update SAX2 feature documentation.
00082  *
00083  * Revision 1.12  2001/09/12 13:03:43  tng
00084  * [Bug 3155] SAX2 does not offer progressive parse.
00085  *
00086  * Revision 1.11  2001/08/01 19:11:02  tng
00087  * Add full schema constraint checking flag to the samples and the parser.
00088  *
00089  * Revision 1.10  2001/06/27 17:40:16  knoaman
00090  * Fix for bug #2353.
00091  *
00092  * Revision 1.9  2001/06/19 16:44:31  tng
00093  * Add installAdvDocHandler to SAX2XMLReader as the code is there already.
00094  *
00095  * Revision 1.8  2001/06/04 21:03:07  jberry
00096  * Add pure virtual getErrorCount to SAX2XMLReader interface.
00097  *
00098  * Revision 1.7  2001/05/11 13:26:25  tng
00099  * Copyright update.
00100  *
00101  * Revision 1.6  2001/02/15 15:56:31  tng
00102  * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
00103  * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
00104  * New data field  fSchemaValidation in XMLScanner as the flag.
00105  *
00106  * Revision 1.5  2001/01/12 21:22:00  tng
00107  * Documentation Enhancement: Add list of SAX2 feature strings that are supported.
00108  *
00109  * Revision 1.4  2000/12/22 15:17:04  tng
00110  * SAX2-ext's LexicalHandler support added by David Bertoni.
00111  *
00112  * Revision 1.3  2000/08/09 22:19:29  jpolast
00113  * many conformance & stability changes:
00114  *   - ContentHandler::resetDocument() removed
00115  *   - attrs param of ContentHandler::startDocument() made const
00116  *   - SAXExceptions thrown now have msgs
00117  *   - removed duplicate function signatures that had 'const'
00118  *       [ eg: getContentHander() ]
00119  *   - changed getFeature and getProperty to apply to const objs
00120  *   - setProperty now takes a void* instead of const void*
00121  *   - SAX2XMLReaderImpl does not inherit from SAXParser anymore
00122  *   - Reuse Validator (http://apache.org/xml/features/reuse-validator) implemented
00123  *   - Features & Properties now read-only during parse
00124  *
00125  * Revision 1.2  2000/08/07 18:21:27  jpolast
00126  * change SAX_EXPORT module to SAX2_EXPORT
00127  *
00128  * Revision 1.1  2000/08/02 18:02:35  jpolast
00129  * initial checkin of sax2 implementation
00130  * submitted by Simon Fell (simon@fell.com)
00131  * and Joe Polastre (jpolast@apache.org)
00132  *
00133  *
00134  */
00135 
00136 #ifndef SAX2XMLReader_HPP
00137 #define SAX2XMLReader_HPP
00138 
00139 #include <xercesc/util/XercesDefs.hpp>
00140 #include <xercesc/util/XMLUniDefs.hpp>
00141 #include <xercesc/framework/XMLValidator.hpp>
00142 #include <xercesc/framework/XMLPScanToken.hpp>
00143 
00144 class ContentHandler ;
00145 class DTDHandler;
00146 class EntityResolver;
00147 class ErrorHandler;
00148 class InputSource;
00149 class LexicalHandler;
00150 class DeclHandler;
00151 class XMLDocumentHandler;
00152 
00153 class SAX2_EXPORT SAX2XMLReader
00154 {
00155 public:
00156 
00157     enum ValSchemes
00158     {
00159         Val_Never
00160         , Val_Always
00161         , Val_Auto
00162     };
00163 
00165     // -----------------------------------------------------------------------
00166     //  Constructors and Destructor
00167     // -----------------------------------------------------------------------
00169     /** The default constructor */
00170     SAX2XMLReader()
00171     {
00172     }
00174     virtual ~SAX2XMLReader()
00175     {
00176     }
00178 
00179     //-----------------------------------------------------------------------
00180     // The XMLReader interface
00181     //-----------------------------------------------------------------------
00184 
00195     virtual int getErrorCount() const = 0 ;
00196 
00202     virtual ContentHandler* getContentHandler() const = 0 ;
00203 
00209     virtual DTDHandler* getDTDHandler() const = 0;
00210 
00216     virtual EntityResolver* getEntityResolver() const = 0 ;
00217 
00223     virtual ErrorHandler* getErrorHandler() const = 0 ;
00224 
00230     virtual LexicalHandler* getLexicalHandler() const = 0 ;
00231 
00237     virtual DeclHandler* getDeclarationHandler() const = 0 ;
00238 
00246         virtual bool getFeature(const XMLCh* const name) const = 0;
00247 
00267         virtual void* getProperty(const XMLCh* const name) const = 0 ;
00268 
00278     virtual bool getExitOnFirstFatalError() const = 0;
00279 
00290     virtual bool getValidationConstraintFatal() const = 0;
00291 
00292 
00318     virtual void parse
00319     (
00320         const   InputSource&    source
00321     ) = 0;
00322 
00342     virtual void parse
00343     (
00344         const   XMLCh* const    systemId
00345     ) = 0;
00346 
00366     virtual void parse
00367     (
00368         const   char* const     systemId
00369     ) = 0;
00370         
00387     virtual void setContentHandler(ContentHandler* const handler) = 0;
00388 
00404     virtual void setDTDHandler(DTDHandler* const handler) = 0;
00405 
00422     virtual void setEntityResolver(EntityResolver* const resolver) = 0;
00423 
00441     virtual void setErrorHandler(ErrorHandler* const handler) = 0;
00442 
00459     virtual void setLexicalHandler(LexicalHandler* const handler) = 0;
00460 
00477     virtual void setDeclarationHandler(DeclHandler* const handler) = 0;
00478 
00494     virtual void setExitOnFirstFatalError(const bool newState) = 0;
00495 
00511     virtual void setValidationConstraintFatal(const bool newState) = 0;
00512 
00533         virtual void setFeature(const XMLCh* const name, const bool value) = 0;
00534 
00558         virtual void setProperty(const XMLCh* const name, void* value) = 0 ;
00559 
00561 
00562     // -----------------------------------------------------------------------
00563     //  Progressive scan methods
00564     // -----------------------------------------------------------------------
00565 
00568 
00599     virtual bool parseFirst
00600     (
00601         const   XMLCh* const    systemId
00602         ,       XMLPScanToken&  toFill
00603         , const bool            reuseGrammar = false
00604     ) = 0;
00605 
00636     virtual bool parseFirst
00637     (
00638         const   char* const     systemId
00639         ,       XMLPScanToken&  toFill
00640         , const bool            reuseGrammar = false
00641     ) = 0;
00642 
00673     virtual bool parseFirst
00674     (
00675         const   InputSource&    source
00676         ,       XMLPScanToken&  toFill
00677         , const bool            reuseGrammar = false
00678     ) = 0;
00679 
00704     virtual bool parseNext(XMLPScanToken& token) = 0;
00705 
00727     virtual void parseReset(XMLPScanToken& token) = 0;
00728 
00730 
00731 
00732     // -----------------------------------------------------------------------
00733     //  Validator: setters and getters
00734     // -----------------------------------------------------------------------
00746         virtual void setValidator(XMLValidator* valueToAdopt) = 0;
00747 
00758         virtual XMLValidator* getValidator() const = 0;
00760 
00761     // -----------------------------------------------------------------------
00762     //  Advanced document handler list maintenance methods
00763     // -----------------------------------------------------------------------
00764 
00780     virtual void installAdvDocHandler(XMLDocumentHandler* const toInstall) = 0;
00781 
00791     virtual bool removeAdvDocHandler(XMLDocumentHandler* const toRemove) = 0;
00793 
00794 private :
00795     /* The copy constructor, you cannot call this directly */
00796     SAX2XMLReader(const SAX2XMLReader&);
00797 
00798     /* The assignment operator, you cannot call this directly */
00799     void operator=(const SAX2XMLReader&);
00800 
00801 };
00802 
00803 #endif

Generated on Tue Nov 19 09:36:32 2002 by doxygen1.3-rc1