http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Download
Installation
Build

API Docs
Samples
Schema

FAQs
Programming
Migration

Releases
Bug-Reporting
Feedback

Y2K Compliance
PDF Document

CVS Repository
Mail Archive

API Docs for SAX and DOM
 

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

SAX2XMLReader.hpp

Go to the documentation of this file.
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.1.1  2002/02/01 22:22:09  peiyongz
00060  * sane_include
00061  *
00062  * Revision 1.18  2002/01/28 18:45:40  knoaman
00063  * Update documentation for SAX2 feature 'namespace-prefixes'.
00064  *
00065  * Revision 1.17  2002/01/28 17:08:33  knoaman
00066  * SAX2-ext's DeclHandler support.
00067  *
00068  * Revision 1.16  2002/01/18 16:31:26  tng
00069  * Break program.xml which takes too long to load, into program-sax.xml, program-sax2.xml, program-dom.xml, program-idom.xml.
00070  *
00071  * Revision 1.15  2002/01/02 15:36:54  tng
00072  * Some documentation update.
00073  *
00074  * Revision 1.14  2001/11/20 18:51:44  tng
00075  * 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).
00076  *
00077  * Revision 1.13  2001/11/14 14:15:59  tng
00078  * Update SAX2 feature documentation.
00079  *
00080  * Revision 1.12  2001/09/12 13:03:43  tng
00081  * [Bug 3155] SAX2 does not offer progressive parse.
00082  *
00083  * Revision 1.11  2001/08/01 19:11:02  tng
00084  * Add full schema constraint checking flag to the samples and the parser.
00085  *
00086  * Revision 1.10  2001/06/27 17:40:16  knoaman
00087  * Fix for bug #2353.
00088  *
00089  * Revision 1.9  2001/06/19 16:44:31  tng
00090  * Add installAdvDocHandler to SAX2XMLReader as the code is there already.
00091  *
00092  * Revision 1.8  2001/06/04 21:03:07  jberry
00093  * Add pure virtual getErrorCount to SAX2XMLReader interface.
00094  *
00095  * Revision 1.7  2001/05/11 13:26:25  tng
00096  * Copyright update.
00097  *
00098  * Revision 1.6  2001/02/15 15:56:31  tng
00099  * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
00100  * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
00101  * New data field  fSchemaValidation in XMLScanner as the flag.
00102  *
00103  * Revision 1.5  2001/01/12 21:22:00  tng
00104  * Documentation Enhancement: Add list of SAX2 feature strings that are supported.
00105  *
00106  * Revision 1.4  2000/12/22 15:17:04  tng
00107  * SAX2-ext's LexicalHandler support added by David Bertoni.
00108  *
00109  * Revision 1.3  2000/08/09 22:19:29  jpolast
00110  * many conformance & stability changes:
00111  *   - ContentHandler::resetDocument() removed
00112  *   - attrs param of ContentHandler::startDocument() made const
00113  *   - SAXExceptions thrown now have msgs
00114  *   - removed duplicate function signatures that had 'const'
00115  *       [ eg: getContentHander() ]
00116  *   - changed getFeature and getProperty to apply to const objs
00117  *   - setProperty now takes a void* instead of const void*
00118  *   - SAX2XMLReaderImpl does not inherit from SAXParser anymore
00119  *   - Reuse Validator (http://apache.org/xml/features/reuse-validator) implemented
00120  *   - Features & Properties now read-only during parse
00121  *
00122  * Revision 1.2  2000/08/07 18:21:27  jpolast
00123  * change  module to 
00124  *
00125  * Revision 1.1  2000/08/02 18:02:35  jpolast
00126  * initial checkin of sax2 implementation
00127  * submitted by Simon Fell (simon@fell.com)
00128  * and Joe Polastre (jpolast@apache.org)
00129  *
00130  *
00131  */
00132 
00133 #ifndef SAX2XMLReader_HPP
00134 #define SAX2XMLReader_HPP
00135 
00136 #include <xercesc/util/XercesDefs.hpp>
00137 #include <xercesc/util/XMLUniDefs.hpp>
00138 #include <xercesc/framework/XMLValidator.hpp>
00139 #include <xercesc/framework/XMLPScanToken.hpp>
00140 
00141 class ContentHandler ;
00142 class DTDHandler;
00143 class EntityResolver;
00144 class ErrorHandler;
00145 class InputSource;
00146 class LexicalHandler;
00147 class DeclHandler;
00148 class XMLDocumentHandler;
00149 
00150 class  SAX2XMLReader
00151 {
00152 public:
00153 
00154     enum ValSchemes
00155     {
00156         Val_Never
00157         , Val_Always
00158         , Val_Auto
00159     };
00160 
00162     // -----------------------------------------------------------------------
00163     //  Constructors and Destructor
00164     // -----------------------------------------------------------------------
00166     /** The default constructor */
00167     SAX2XMLReader()
00168     {
00169     }
00171     virtual ~SAX2XMLReader()
00172     {
00173     }
00175 
00176     //-----------------------------------------------------------------------
00177     // The XMLReader interface
00178     //-----------------------------------------------------------------------
00181 
00192     virtual int getErrorCount() const = 0 ;
00193 
00199     virtual ContentHandler* getContentHandler() const = 0 ;
00200 
00206     virtual DTDHandler* getDTDHandler() const = 0;
00207 
00213     virtual EntityResolver* getEntityResolver() const = 0 ;
00214 
00220     virtual ErrorHandler* getErrorHandler() const = 0 ;
00221 
00227     virtual LexicalHandler* getLexicalHandler() const = 0 ;
00228 
00234     virtual DeclHandler* getDeclarationHandler() const = 0 ;
00235 
00243     virtual bool getFeature(const XMLCh* const name) const = 0;
00244 
00264     virtual void* getProperty(const XMLCh* const name) const = 0 ;
00265 
00275     virtual bool getExitOnFirstFatalError() const = 0;
00276 
00287     virtual bool getValidationConstraintFatal() const = 0;
00288 
00289 
00315     virtual void parse
00316     (
00317         const   InputSource&    source
00318     ) = 0;
00319 
00339     virtual void parse
00340     (
00341         const   XMLCh* const    systemId
00342     ) = 0;
00343 
00363     virtual void parse
00364     (
00365         const   char* const     systemId
00366     ) = 0;
00367     
00384     virtual void setContentHandler(ContentHandler* const handler) = 0;
00385 
00401     virtual void setDTDHandler(DTDHandler* const handler) = 0;
00402 
00419     virtual void setEntityResolver(EntityResolver* const resolver) = 0;
00420 
00438     virtual void setErrorHandler(ErrorHandler* const handler) = 0;
00439 
00456     virtual void setLexicalHandler(LexicalHandler* const handler) = 0;
00457 
00474     virtual void setDeclarationHandler(DeclHandler* const handler) = 0;
00475 
00491     virtual void setExitOnFirstFatalError(const bool newState) = 0;
00492 
00508     virtual void setValidationConstraintFatal(const bool newState) = 0;
00509 
00530     virtual void setFeature(const XMLCh* const name, const bool value) = 0;
00531 
00555     virtual void setProperty(const XMLCh* const name, void* value) = 0 ;
00556 
00558 
00559     // -----------------------------------------------------------------------
00560     //  Progressive scan methods
00561     // -----------------------------------------------------------------------
00562 
00565 
00596     virtual bool parseFirst
00597     (
00598         const   XMLCh* const    systemId
00599         ,       XMLPScanToken&  toFill
00600         , const bool            reuseGrammar = false
00601     ) = 0;
00602 
00633     virtual bool parseFirst
00634     (
00635         const   char* const     systemId
00636         ,       XMLPScanToken&  toFill
00637         , const bool            reuseGrammar = false
00638     ) = 0;
00639 
00670     virtual bool parseFirst
00671     (
00672         const   InputSource&    source
00673         ,       XMLPScanToken&  toFill
00674         , const bool            reuseGrammar = false
00675     ) = 0;
00676 
00701     virtual bool parseNext(XMLPScanToken& token) = 0;
00702 
00724     virtual void parseReset(XMLPScanToken& token) = 0;
00725 
00727 
00728 
00729     // -----------------------------------------------------------------------
00730     //  Validator: setters and getters
00731     // -----------------------------------------------------------------------
00734 
00743     virtual void setValidator(XMLValidator* valueToAdopt) = 0;
00744 
00755     virtual XMLValidator* getValidator() const = 0;
00757 
00758     // -----------------------------------------------------------------------
00759     //  Advanced document handler list maintenance methods
00760     // -----------------------------------------------------------------------
00761 
00764 
00777     virtual void installAdvDocHandler(XMLDocumentHandler* const toInstall) = 0;
00778 
00788     virtual bool removeAdvDocHandler(XMLDocumentHandler* const toRemove) = 0;
00790 
00791 private :
00792     /* The copy constructor, you cannot call this directly */
00793     SAX2XMLReader(const SAX2XMLReader&);
00794 
00795     /* The assignment operator, you cannot call this directly */
00796     void operator=(const SAX2XMLReader&);
00797 
00798 };
00799 
00800 #endif


Copyright © 2000 The Apache Software Foundation. All Rights Reserved.