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.14  2001/11/20 18:51:44  tng
00060  * 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).
00061  *
00062  * Revision 1.13  2001/11/14 14:15:59  tng
00063  * Update SAX2 feature documentation.
00064  *
00065  * Revision 1.12  2001/09/12 13:03:43  tng
00066  * [Bug 3155] SAX2 does not offer progressive parse.
00067  *
00068  * Revision 1.11  2001/08/01 19:11:02  tng
00069  * Add full schema constraint checking flag to the samples and the parser.
00070  *
00071  * Revision 1.10  2001/06/27 17:40:16  knoaman
00072  * Fix for bug #2353.
00073  *
00074  * Revision 1.9  2001/06/19 16:44:31  tng
00075  * Add installAdvDocHandler to SAX2XMLReader as the code is there already.
00076  *
00077  * Revision 1.8  2001/06/04 21:03:07  jberry
00078  * Add pure virtual getErrorCount to SAX2XMLReader interface.
00079  *
00080  * Revision 1.7  2001/05/11 13:26:25  tng
00081  * Copyright update.
00082  *
00083  * Revision 1.6  2001/02/15 15:56:31  tng
00084  * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
00085  * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
00086  * New data field  fSchemaValidation in XMLScanner as the flag.
00087  *
00088  * Revision 1.5  2001/01/12 21:22:00  tng
00089  * Documentation Enhancement: Add list of SAX2 feature strings that are supported.
00090  *
00091  * Revision 1.4  2000/12/22 15:17:04  tng
00092  * SAX2-ext's LexicalHandler support added by David Bertoni.
00093  *
00094  * Revision 1.3  2000/08/09 22:19:29  jpolast
00095  * many conformance & stability changes:
00096  *   - ContentHandler::resetDocument() removed
00097  *   - attrs param of ContentHandler::startDocument() made const
00098  *   - SAXExceptions thrown now have msgs
00099  *   - removed duplicate function signatures that had 'const'
00100  *       [ eg: getContentHander() ]
00101  *   - changed getFeature and getProperty to apply to const objs
00102  *   - setProperty now takes a void* instead of const void*
00103  *   - SAX2XMLReaderImpl does not inherit from SAXParser anymore
00104  *   - Reuse Validator (http://apache.org/xml/features/reuse-validator) implemented
00105  *   - Features & Properties now read-only during parse
00106  *
00107  * Revision 1.2  2000/08/07 18:21:27  jpolast
00108  * change  module to 
00109  *
00110  * Revision 1.1  2000/08/02 18:02:35  jpolast
00111  * initial checkin of sax2 implementation
00112  * submitted by Simon Fell (simon@fell.com)
00113  * and Joe Polastre (jpolast@apache.org)
00114  *
00115  *
00116  */
00117 
00118 #ifndef SAX2XMLReader_HPP
00119 #define SAX2XMLReader_HPP
00120 
00121 #include <util/XercesDefs.hpp>
00122 #include <util/XMLUniDefs.hpp>
00123 #include <framework/XMLValidator.hpp>
00124 #include <framework/XMLPScanToken.hpp>
00125 
00126 class ContentHandler ;
00127 class DTDHandler;
00128 class EntityResolver;
00129 class ErrorHandler;
00130 class InputSource;
00131 class LexicalHandler;
00132 class XMLDocumentHandler;
00133 
00134 class  SAX2XMLReader
00135 {
00136 public:
00137 
00138     enum ValSchemes
00139     {
00140         Val_Never
00141         , Val_Always
00142         , Val_Auto
00143     };
00144 
00146     // -----------------------------------------------------------------------
00147     //  Constructors and Destructor
00148     // -----------------------------------------------------------------------
00150     /** The default constructor */
00151     SAX2XMLReader()
00152     {
00153     }
00155     virtual ~SAX2XMLReader()
00156     {
00157     }
00159 
00160     //-----------------------------------------------------------------------
00161     // The XMLReader interface
00162     //-----------------------------------------------------------------------
00165 
00176     virtual int getErrorCount() const = 0 ;
00177 
00183     virtual ContentHandler* getContentHandler() const = 0 ;
00184 
00190     virtual DTDHandler* getDTDHandler() const = 0;
00191 
00197     virtual EntityResolver* getEntityResolver() const = 0 ;
00198 
00204     virtual ErrorHandler* getErrorHandler() const = 0 ;
00205 
00211     virtual LexicalHandler* getLexicalHandler() const = 0 ;
00212 
00220     virtual bool getFeature(const XMLCh* const name) const = 0;
00221 
00241     virtual void* getProperty(const XMLCh* const name) const = 0 ;
00242 
00252     virtual bool getExitOnFirstFatalError() const = 0;
00253 
00264     virtual bool getValidationConstraintFatal() const = 0;
00265 
00266 
00292     virtual void parse
00293     (
00294         const   InputSource&    source
00295     ) = 0;
00296 
00316     virtual void parse
00317     (
00318         const   XMLCh* const    systemId
00319     ) = 0;
00320 
00340     virtual void parse
00341     (
00342         const   char* const     systemId
00343     ) = 0;
00344     
00361     virtual void setContentHandler(ContentHandler* const handler) = 0;
00362 
00378     virtual void setDTDHandler(DTDHandler* const handler) = 0;
00379 
00396     virtual void setEntityResolver(EntityResolver* const resolver) = 0;
00397 
00415     virtual void setErrorHandler(ErrorHandler* const handler) = 0;
00416 
00433     virtual void setLexicalHandler(LexicalHandler* const handler) = 0;
00434 
00450     virtual void setExitOnFirstFatalError(const bool newState) = 0;
00451 
00467     virtual void setValidationConstraintFatal(const bool newState) = 0;
00468 
00489     virtual void setFeature(const XMLCh* const name, const bool value) = 0;
00490 
00514     virtual void setProperty(const XMLCh* const name, void* value) = 0 ;
00515 
00517 
00518     // -----------------------------------------------------------------------
00519     //  Progressive scan methods
00520     // -----------------------------------------------------------------------
00521 
00524 
00555     virtual bool parseFirst
00556     (
00557         const   XMLCh* const    systemId
00558         ,       XMLPScanToken&  toFill
00559         , const bool            reuseGrammar = false
00560     ) = 0;
00561 
00592     virtual bool parseFirst
00593     (
00594         const   char* const     systemId
00595         ,       XMLPScanToken&  toFill
00596         , const bool            reuseGrammar = false
00597     ) = 0;
00598 
00629     virtual bool parseFirst
00630     (
00631         const   InputSource&    source
00632         ,       XMLPScanToken&  toFill
00633         , const bool            reuseGrammar = false
00634     ) = 0;
00635 
00660     virtual bool parseNext(XMLPScanToken& token) = 0;
00661 
00683     virtual void parseReset(XMLPScanToken& token) = 0;
00684 
00686 
00687 
00688     // -----------------------------------------------------------------------
00689     //  Validator: setters and getters
00690     // -----------------------------------------------------------------------
00693 
00702     virtual void setValidator(XMLValidator* valueToAdopt) = 0;
00703 
00714     virtual XMLValidator* getValidator() const = 0;
00716 
00717     // -----------------------------------------------------------------------
00718     //  Advanced document handler list maintenance methods
00719     // -----------------------------------------------------------------------
00720 
00723 
00736     virtual void installAdvDocHandler(XMLDocumentHandler* const toInstall) = 0;
00737 
00747     virtual bool removeAdvDocHandler(XMLDocumentHandler* const toRemove) = 0;
00749 
00750 private :
00751     /* The copy constructor, you cannot call this directly */
00752     SAX2XMLReader(const SAX2XMLReader&);
00753 
00754     /* The assignment operator, you cannot call this directly */
00755     void operator=(const SAX2XMLReader&);
00756 
00757 };
00758 
00759 #endif


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