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

Home

Readme
Charter
Release Info

Installation
Download
Build Instructions

FAQs
Samples
API Docs

DOM C++ Binding
Programming
Migration Guide

Feedback
Bug-Reporting
PDF Document

Source Repository
User Mail Archive
Devel Mail Archive

API Docs for SAX and DOM
 

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 191708 2005-06-21 19:02:15Z cargilld $
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 
00202     unsigned int getSrcOffset() const;
00203 
00211     bool getIgnoreCachedDTD() const;
00212 
00214 
00215 
00216     // -----------------------------------------------------------------------
00217     //  Setter methods
00218     // -----------------------------------------------------------------------
00219 
00222 
00236     void setErrorHandler(ErrorHandler* const handler);
00237 
00254     void setEntityResolver(EntityResolver* const handler);
00255 
00273     void setXMLEntityResolver(XMLEntityResolver* const handler);
00274 
00292     void cacheGrammarFromParse(const bool newState);
00293 
00312     void useCachedGrammarInParse(const bool newState);
00313 
00328     void setIgnoreCachedDTD(const bool newValue);
00329 
00331 
00332     // -----------------------------------------------------------------------
00333     //  Utility methods
00334     // -----------------------------------------------------------------------
00335 
00361     void resetDocumentPool();
00362 
00364 
00365     // -----------------------------------------------------------------------
00366     //  Implementation of the XMLErrorReporter interface.
00367     // -----------------------------------------------------------------------
00368 
00371 
00396     virtual void error
00397     (
00398         const   unsigned int                errCode
00399         , const XMLCh* const                msgDomain
00400         , const XMLErrorReporter::ErrTypes  errType
00401         , const XMLCh* const                errorText
00402         , const XMLCh* const                systemId
00403         , const XMLCh* const                publicId
00404         , const XMLSSize_t                  lineNum
00405         , const XMLSSize_t                  colNum
00406     );
00407 
00416     virtual void resetErrors();
00418 
00419 
00420     // -----------------------------------------------------------------------
00421     //  Implementation of the XMLEntityHandler interface.
00422     // -----------------------------------------------------------------------
00423 
00426 
00439     virtual void endInputSource(const InputSource& inputSource);
00440 
00456     virtual bool expandSystemId
00457     (
00458         const   XMLCh* const    systemId
00459         ,       XMLBuffer&      toFill
00460     );
00461 
00470     virtual void resetEntities();
00471 
00495     virtual InputSource* resolveEntity
00496     (
00497         const   XMLCh* const    publicId
00498         , const XMLCh* const    systemId
00499         , const XMLCh* const    baseURI = 0
00500     );
00501 
00518     virtual InputSource* resolveEntity
00519     (
00520         XMLResourceIdentifier* resourceIdentifier
00521     );
00522 
00535     virtual void startInputSource(const InputSource& inputSource);
00536 
00538 
00539     // -----------------------------------------------------------------------
00540     //  Grammar preparsing interface
00541     // -----------------------------------------------------------------------
00542 
00572     Grammar* loadGrammar(const InputSource& source,
00573                          const short grammarType,
00574                          const bool toCache = false);
00575 
00601     Grammar* loadGrammar(const XMLCh* const systemId,
00602                          const short grammarType,
00603                          const bool toCache = false);
00604 
00629     Grammar* loadGrammar(const char* const systemId,
00630                          const short grammarType,
00631                          const bool toCache = false);
00632 
00636     void resetCachedGrammarPool();
00637 
00639 
00640 
00641 private :
00642     // -----------------------------------------------------------------------
00643     //  Initialize/Cleanup methods
00644     // -----------------------------------------------------------------------
00645     void resetParse();
00646 
00647     // -----------------------------------------------------------------------
00648     //  Unimplemented constructors and operators
00649     // -----------------------------------------------------------------------
00650     XercesDOMParser(const XercesDOMParser&);
00651     XercesDOMParser& operator=(const XercesDOMParser&);
00652 
00653     // -----------------------------------------------------------------------
00654     //  Private data members
00655     //
00656     //  fEntityResolver
00657     //      The installed SAX entity resolver, if any. Null if none.
00658     //
00659     //  fErrorHandler
00660     //      The installed SAX error handler, if any. Null if none.
00661     //-----------------------------------------------------------------------
00662     EntityResolver*          fEntityResolver;
00663     XMLEntityResolver*       fXMLEntityResolver;
00664     ErrorHandler*            fErrorHandler;
00665 };
00666 
00667 
00668 
00669 // ---------------------------------------------------------------------------
00670 //  XercesDOMParser: Handlers for the XMLEntityHandler interface
00671 // ---------------------------------------------------------------------------
00672 inline void XercesDOMParser::endInputSource(const InputSource&)
00673 {
00674     // The DOM entity resolver doesn't handle this
00675 }
00676 
00677 inline bool XercesDOMParser::expandSystemId(const XMLCh* const, XMLBuffer&)
00678 {
00679     // The DOM entity resolver doesn't handle this
00680     return false;
00681 }
00682 
00683 inline void XercesDOMParser::resetEntities()
00684 {
00685     // Nothing to do on this one
00686 }
00687 
00688 inline void XercesDOMParser::startInputSource(const InputSource&)
00689 {
00690     // The DOM entity resolver doesn't handle this
00691 }
00692 
00693 
00694 // ---------------------------------------------------------------------------
00695 //  XercesDOMParser: Getter methods
00696 // ---------------------------------------------------------------------------
00697 inline ErrorHandler* XercesDOMParser::getErrorHandler()
00698 {
00699     return fErrorHandler;
00700 }
00701 
00702 inline const ErrorHandler* XercesDOMParser::getErrorHandler() const
00703 {
00704     return fErrorHandler;
00705 }
00706 
00707 inline EntityResolver* XercesDOMParser::getEntityResolver()
00708 {
00709     return fEntityResolver;
00710 }
00711 
00712 inline const EntityResolver* XercesDOMParser::getEntityResolver() const
00713 {
00714     return fEntityResolver;
00715 }
00716 
00717 inline XMLEntityResolver* XercesDOMParser::getXMLEntityResolver()
00718 {
00719     return fXMLEntityResolver;
00720 }
00721 
00722 inline const XMLEntityResolver* XercesDOMParser::getXMLEntityResolver() const
00723 {
00724     return fXMLEntityResolver;
00725 }
00726 
00727 XERCES_CPP_NAMESPACE_END
00728 
00729 #endif


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