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

Home

Readme
Release Info

Installation
Download
Build

FAQs
Samples
API Docs

DOM C++ Binding
Programming
Migration Guide

Feedback
Bug-Reporting
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  

XercesDOMParser.hpp

Go to the documentation of this file.
00001 /*
00002  * The Apache Software License, Version 1.1
00003  *
00004  * Copyright (c) 2001-2002 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) 2001, 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  * $Id: XercesDOMParser.hpp,v 1.10 2002/07/11 18:27:03 knoaman Exp $
00059  *
00060  */
00061 
00062 #if !defined(XercesDOMParser_HPP)
00063 #define XercesDOMParser_HPP
00064 
00065 
00066 #include <xercesc/parsers/AbstractDOMParser.hpp>
00067 
00068 class EntityResolver;
00069 class ErrorHandler;
00070 class Grammar;
00071 
00072 
00083 class  XercesDOMParser : public AbstractDOMParser
00084 {
00085 public :
00086     // -----------------------------------------------------------------------
00087     //  Constructors and Detructor
00088     // -----------------------------------------------------------------------
00089 
00092 
00101     XercesDOMParser(XMLValidator* const valToAdopt = 0);
00102 
00106     virtual ~XercesDOMParser();
00107 
00109 
00110 
00111     // -----------------------------------------------------------------------
00112     //  Getter methods
00113     // -----------------------------------------------------------------------
00114 
00117 
00125     ErrorHandler* getErrorHandler();
00126 
00134     const ErrorHandler* getErrorHandler() const;
00135 
00143     EntityResolver* getEntityResolver();
00144 
00152     const EntityResolver* getEntityResolver() const;
00153 
00164     bool isCachingGrammarFromParse() const;
00165 
00176     bool isUsingCachedGrammarInParse() const;
00177 
00184     Grammar* getGrammar(const XMLCh* const nameSpaceKey);
00185 
00191     Grammar* getRootGrammar();
00192     
00199     const XMLCh* getURIText(unsigned int uriId);
00200 
00202 
00203 
00204     // -----------------------------------------------------------------------
00205     //  Setter methods
00206     // -----------------------------------------------------------------------
00207 
00210 
00224     void setErrorHandler(ErrorHandler* const handler);
00225 
00241     void setEntityResolver(EntityResolver* const handler);
00242 
00260     void cacheGrammarFromParse(const bool newState);
00261 
00280     void useCachedGrammarInParse(const bool newState);
00281 
00283 
00284     // -----------------------------------------------------------------------
00285     //  Utility methods
00286     // -----------------------------------------------------------------------
00287 
00290 
00313     void resetDocumentPool();
00314 
00316 
00317     // -----------------------------------------------------------------------
00318     //  Implementation of the XMLErrorReporter interface.
00319     // -----------------------------------------------------------------------
00320 
00323 
00348     virtual void error
00349     (
00350         const   unsigned int                errCode
00351         , const XMLCh* const                msgDomain
00352         , const XMLErrorReporter::ErrTypes  errType
00353         , const XMLCh* const                errorText
00354         , const XMLCh* const                systemId
00355         , const XMLCh* const                publicId
00356         , const XMLSSize_t                  lineNum
00357         , const XMLSSize_t                  colNum
00358     );
00359 
00368     virtual void resetErrors();
00370 
00371 
00372     // -----------------------------------------------------------------------
00373     //  Implementation of the XMLEntityHandler interface.
00374     // -----------------------------------------------------------------------
00375 
00378 
00391     virtual void endInputSource(const InputSource& inputSource);
00392 
00408     virtual bool expandSystemId
00409     (
00410         const   XMLCh* const    systemId
00411         ,       XMLBuffer&      toFill
00412     );
00413 
00422     virtual void resetEntities();
00423 
00445     virtual InputSource* resolveEntity
00446     (
00447         const   XMLCh* const    publicId
00448         , const XMLCh* const    systemId
00449         , const XMLCh* const    baseURI = 0
00450     );
00451 
00464     virtual void startInputSource(const InputSource& inputSource);
00465 
00467 
00468     // -----------------------------------------------------------------------
00469     //  Grammar preparsing interface
00470     // -----------------------------------------------------------------------
00471 
00474 
00501     Grammar* loadGrammar(const InputSource& source,
00502                          const short grammarType,
00503                          const bool toCache = false);
00504 
00530     Grammar* loadGrammar(const XMLCh* const systemId,
00531                          const short grammarType,
00532                          const bool toCache = false);
00533 
00558     Grammar* loadGrammar(const char* const systemId,
00559                          const short grammarType,
00560                          const bool toCache = false);
00561 
00565     void resetCachedGrammarPool();
00566 
00568 
00569 
00570 private :
00571     // -----------------------------------------------------------------------
00572     //  Private data members
00573     //
00574     //  fEntityResolver
00575     //      The installed SAX entity resolver, if any. Null if none.
00576     //
00577     //  fErrorHandler
00578     //      The installed SAX error handler, if any. Null if none.
00579     //-----------------------------------------------------------------------
00580     EntityResolver*          fEntityResolver;
00581     ErrorHandler*            fErrorHandler;
00582 };
00583 
00584 
00585 
00586 // ---------------------------------------------------------------------------
00587 //  XercesDOMParser: Handlers for the XMLEntityHandler interface
00588 // ---------------------------------------------------------------------------
00589 inline void XercesDOMParser::endInputSource(const InputSource&)
00590 {
00591     // The DOM entity resolver doesn't handle this
00592 }
00593 
00594 inline bool XercesDOMParser::expandSystemId(const XMLCh* const, XMLBuffer&)
00595 {
00596     // The DOM entity resolver doesn't handle this
00597     return false;
00598 }
00599 
00600 inline void XercesDOMParser::resetEntities()
00601 {
00602     // Nothing to do on this one
00603 }
00604 
00605 inline void XercesDOMParser::startInputSource(const InputSource&)
00606 {
00607     // The DOM entity resolver doesn't handle this
00608 }
00609 
00610 
00611 // ---------------------------------------------------------------------------
00612 //  XercesDOMParser: Getter methods
00613 // ---------------------------------------------------------------------------
00614 inline ErrorHandler* XercesDOMParser::getErrorHandler()
00615 {
00616     return fErrorHandler;
00617 }
00618 
00619 inline const ErrorHandler* XercesDOMParser::getErrorHandler() const
00620 {
00621     return fErrorHandler;
00622 }
00623 
00624 inline EntityResolver* XercesDOMParser::getEntityResolver()
00625 {
00626     return fEntityResolver;
00627 }
00628 
00629 inline const EntityResolver* XercesDOMParser::getEntityResolver() const
00630 {
00631     return fEntityResolver;
00632 }
00633 
00634 
00635 #endif


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