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  * Copyright 2001-2002,2004 The Apache Software Foundation.
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 /*
00018  * $Id: XercesDOMParser.hpp,v 1.20 2004/09/08 13:56:18 peiyongz Exp $
00019  *
00020  */
00021 
00022 #if !defined(XercesDOMParser_HPP)
00023 #define XercesDOMParser_HPP
00024 
00025 
00026 #include <xercesc/parsers/AbstractDOMParser.hpp>
00027 
00028 XERCES_CPP_NAMESPACE_BEGIN
00029 
00030 
00031 class EntityResolver;
00032 class ErrorHandler;
00033 class Grammar;
00034 class XMLEntityResolver;
00035 class XMLResourceIdentifier;
00036 
00047 class  XercesDOMParser : public AbstractDOMParser
00048 {
00049 public :
00050     // -----------------------------------------------------------------------
00051     //  Constructors and Detructor
00052     // -----------------------------------------------------------------------
00053 
00071     XercesDOMParser
00072     (
00073           XMLValidator* const   valToAdopt = 0
00074         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
00075         , XMLGrammarPool* const gramPool = 0        
00076     );
00077 
00081     virtual ~XercesDOMParser();
00082 
00084 
00085 
00086     // -----------------------------------------------------------------------
00087     //  Getter methods
00088     // -----------------------------------------------------------------------
00089 
00092 
00100     ErrorHandler* getErrorHandler();
00101 
00109     const ErrorHandler* getErrorHandler() const;
00110 
00118     EntityResolver* getEntityResolver();
00119 
00127     const EntityResolver* getEntityResolver() const;
00128 
00137     XMLEntityResolver* getXMLEntityResolver();
00138  
00147     const XMLEntityResolver* getXMLEntityResolver() const;
00148 
00159     bool isCachingGrammarFromParse() const;
00160 
00171     bool isUsingCachedGrammarInParse() const;
00172 
00179     Grammar* getGrammar(const XMLCh* const nameSpaceKey);
00180 
00186     Grammar* getRootGrammar();
00187 
00194     const XMLCh* getURIText(unsigned int uriId) const;
00195 
00201     unsigned int getSrcOffset() const;
00202 
00204 
00205 
00206     // -----------------------------------------------------------------------
00207     //  Setter methods
00208     // -----------------------------------------------------------------------
00209 
00212 
00226     void setErrorHandler(ErrorHandler* const handler);
00227 
00244     void setEntityResolver(EntityResolver* const handler);
00245 
00263     void setXMLEntityResolver(XMLEntityResolver* const handler);
00264 
00282     void cacheGrammarFromParse(const bool newState);
00283 
00302     void useCachedGrammarInParse(const bool newState);
00303 
00305 
00306     // -----------------------------------------------------------------------
00307     //  Utility methods
00308     // -----------------------------------------------------------------------
00309 
00335     void resetDocumentPool();
00336 
00338 
00339     // -----------------------------------------------------------------------
00340     //  Implementation of the XMLErrorReporter interface.
00341     // -----------------------------------------------------------------------
00342 
00345 
00370     virtual void error
00371     (
00372         const   unsigned int                errCode
00373         , const XMLCh* const                msgDomain
00374         , const XMLErrorReporter::ErrTypes  errType
00375         , const XMLCh* const                errorText
00376         , const XMLCh* const                systemId
00377         , const XMLCh* const                publicId
00378         , const XMLSSize_t                  lineNum
00379         , const XMLSSize_t                  colNum
00380     );
00381 
00390     virtual void resetErrors();
00392 
00393 
00394     // -----------------------------------------------------------------------
00395     //  Implementation of the XMLEntityHandler interface.
00396     // -----------------------------------------------------------------------
00397 
00400 
00413     virtual void endInputSource(const InputSource& inputSource);
00414 
00430     virtual bool expandSystemId
00431     (
00432         const   XMLCh* const    systemId
00433         ,       XMLBuffer&      toFill
00434     );
00435 
00444     virtual void resetEntities();
00445 
00469     virtual InputSource* resolveEntity
00470     (
00471         const   XMLCh* const    publicId
00472         , const XMLCh* const    systemId
00473         , const XMLCh* const    baseURI = 0
00474     );
00475 
00492     virtual InputSource* resolveEntity
00493     (
00494         XMLResourceIdentifier* resourceIdentifier
00495     );
00496 
00509     virtual void startInputSource(const InputSource& inputSource);
00510 
00512 
00513     // -----------------------------------------------------------------------
00514     //  Grammar preparsing interface
00515     // -----------------------------------------------------------------------
00516 
00546     Grammar* loadGrammar(const InputSource& source,
00547                          const short grammarType,
00548                          const bool toCache = false);
00549 
00575     Grammar* loadGrammar(const XMLCh* const systemId,
00576                          const short grammarType,
00577                          const bool toCache = false);
00578 
00603     Grammar* loadGrammar(const char* const systemId,
00604                          const short grammarType,
00605                          const bool toCache = false);
00606 
00610     void resetCachedGrammarPool();
00611 
00613 
00614 
00615 private :
00616     // -----------------------------------------------------------------------
00617     //  Unimplemented constructors and operators
00618     // -----------------------------------------------------------------------
00619     XercesDOMParser(const XercesDOMParser&);
00620     XercesDOMParser& operator=(const XercesDOMParser&);
00621 
00622     // -----------------------------------------------------------------------
00623     //  Private data members
00624     //
00625     //  fEntityResolver
00626     //      The installed SAX entity resolver, if any. Null if none.
00627     //
00628     //  fErrorHandler
00629     //      The installed SAX error handler, if any. Null if none.
00630     //-----------------------------------------------------------------------
00631     EntityResolver*          fEntityResolver;
00632     XMLEntityResolver*       fXMLEntityResolver;
00633     ErrorHandler*            fErrorHandler;
00634 };
00635 
00636 
00637 
00638 // ---------------------------------------------------------------------------
00639 //  XercesDOMParser: Handlers for the XMLEntityHandler interface
00640 // ---------------------------------------------------------------------------
00641 inline void XercesDOMParser::endInputSource(const InputSource&)
00642 {
00643     // The DOM entity resolver doesn't handle this
00644 }
00645 
00646 inline bool XercesDOMParser::expandSystemId(const XMLCh* const, XMLBuffer&)
00647 {
00648     // The DOM entity resolver doesn't handle this
00649     return false;
00650 }
00651 
00652 inline void XercesDOMParser::resetEntities()
00653 {
00654     // Nothing to do on this one
00655 }
00656 
00657 inline void XercesDOMParser::startInputSource(const InputSource&)
00658 {
00659     // The DOM entity resolver doesn't handle this
00660 }
00661 
00662 
00663 // ---------------------------------------------------------------------------
00664 //  XercesDOMParser: Getter methods
00665 // ---------------------------------------------------------------------------
00666 inline ErrorHandler* XercesDOMParser::getErrorHandler()
00667 {
00668     return fErrorHandler;
00669 }
00670 
00671 inline const ErrorHandler* XercesDOMParser::getErrorHandler() const
00672 {
00673     return fErrorHandler;
00674 }
00675 
00676 inline EntityResolver* XercesDOMParser::getEntityResolver()
00677 {
00678     return fEntityResolver;
00679 }
00680 
00681 inline const EntityResolver* XercesDOMParser::getEntityResolver() const
00682 {
00683     return fEntityResolver;
00684 }
00685 
00686 inline XMLEntityResolver* XercesDOMParser::getXMLEntityResolver()
00687 {
00688     return fXMLEntityResolver;
00689 }
00690 
00691 inline const XMLEntityResolver* XercesDOMParser::getXMLEntityResolver() const
00692 {
00693     return fXMLEntityResolver;
00694 }
00695 
00696 XERCES_CPP_NAMESPACE_END
00697 
00698 #endif


Copyright © 1994-2004 The Apache Software Foundation. All Rights Reserved.