⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xercesdomparser.hpp

📁 经典开源游戏glest的源代码
💻 HPP
📖 第 1 页 / 共 2 页
字号:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements.  See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License.  You may obtain a copy of the License at *  *      http://www.apache.org/licenses/LICENSE-2.0 *  * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//* * $Id: XercesDOMParser.hpp 568078 2007-08-21 11:43:25Z amassari $ * */#if !defined(XercesDOMParser_HPP)#define XercesDOMParser_HPP#include <xercesc/parsers/AbstractDOMParser.hpp>XERCES_CPP_NAMESPACE_BEGINclass EntityResolver;class ErrorHandler;class Grammar;class XMLEntityResolver;class XMLResourceIdentifier; /**  * This class implements the Document Object Model (DOM) interface.  * It should be used by applications which choose to parse and  * process the XML document using the DOM api's. This implementation  * also allows the applications to install an error and an entitty  * handler (useful extensions to the DOM specification).  *  * <p>It can be used to instantiate a validating or non-validating  * parser, by setting a member flag.</p>  */class PARSERS_EXPORT XercesDOMParser : public AbstractDOMParser{public :    // -----------------------------------------------------------------------    //  Constructors and Detructor    // -----------------------------------------------------------------------    /** @name Constructors and Destructor */    //@{    /** Construct a XercesDOMParser, with an optional validator      *      * Constructor with an instance of validator class to use for      * validation. If you don't provide a validator, a default one will      * be created for you in the scanner.      *      * @param gramPool   Pointer to the grammar pool instance from       *                   external application.      *                   The parser does NOT own it.      *      * @param valToAdopt Pointer to the validator instance to use. The      *                   parser is responsible for freeing the memory.      * @param  manager   Pointer to the memory manager to be used to      *                   allocate objects.      */    XercesDOMParser    (          XMLValidator* const   valToAdopt = 0        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager        , XMLGrammarPool* const gramPool = 0            );    /**      * Destructor      */    virtual ~XercesDOMParser();    //@}    // -----------------------------------------------------------------------    //  Getter methods    // -----------------------------------------------------------------------    /** @name Getter methods */    //@{    /** Get a pointer to the error handler      *      * This method returns the installed error handler. If no handler      * has been installed, then it will be a zero pointer.      *      * @return The pointer to the installed error handler object.      */    ErrorHandler* getErrorHandler();    /** Get a const pointer to the error handler      *      * This method returns the installed error handler.  If no handler      * has been installed, then it will be a zero pointer.      *      * @return A const pointer to the installed error handler object.      */    const ErrorHandler* getErrorHandler() const;    /** Get a pointer to the entity resolver      *      * This method returns the installed entity resolver.  If no resolver      * has been installed, then it will be a zero pointer.      *      * @return The pointer to the installed entity resolver object.      */    EntityResolver* getEntityResolver();    /** Get a const pointer to the entity resolver      *      * This method returns the installed entity resolver. If no resolver      * has been installed, then it will be a zero pointer.      *      * @return A const pointer to the installed entity resolver object.      */    const EntityResolver* getEntityResolver() const;    /**      * Get a pointer to the entity resolver      *      * This method returns the installed entity resolver.  If no resolver      * has been installed, then it will be a zero pointer.      *      * @return The pointer to the installed entity resolver object.      */    XMLEntityResolver* getXMLEntityResolver();     /**      * Get a const pointer to the entity resolver      *      * This method returns the installed entity resolver. If no resolver      * has been installed, then it will be a zero pointer.      *      * @return A const pointer to the installed entity resolver object.      */    const XMLEntityResolver* getXMLEntityResolver() const;    /** Get the 'Grammar caching' flag      *      * This method returns the state of the parser's grammar caching when      * parsing an XML document.      *      * @return true, if the parser is currently configured to      *         cache grammars, false otherwise.      *      * @see #cacheGrammarFromParse      */    bool isCachingGrammarFromParse() const;    /** Get the 'Use cached grammar' flag      *      * This method returns the state of the parser's use of cached grammar      * when parsing an XML document.      *      * @return true, if the parser is currently configured to      *         use cached grammars, false otherwise.      *      * @see #useCachedGrammarInParse      */    bool isUsingCachedGrammarInParse() const;    /**     * Retrieve the grammar that is associated with the specified namespace key     *     * @param  nameSpaceKey Namespace key     * @return Grammar associated with the Namespace key.     */    Grammar* getGrammar(const XMLCh* const nameSpaceKey);    /**     * Retrieve the grammar where the root element is declared.     *     * @return Grammar where root element declared     */    Grammar* getRootGrammar();    /**     * Returns the string corresponding to a URI id from the URI string pool.     *     * @param uriId id of the string in the URI string pool.     * @return URI string corresponding to the URI id.     */    const XMLCh* getURIText(unsigned int uriId) const;    /**     * Returns the current src offset within the input source.     * To be used only while parsing is in progress.     *     * @return offset within the input source     */    unsigned int getSrcOffset() const;    /** Get the 'ignore cached DTD grammar' flag      *          * @return true, if the parser is currently configured to      *         ignore cached DTD, false otherwise.      *      * @see #setIgnoreCachedDTD      */    bool getIgnoreCachedDTD() const;    //@}    // -----------------------------------------------------------------------    //  Setter methods    // -----------------------------------------------------------------------    /** @name Setter methods */    //@{    /** Set the error handler      *      * This method allows applications to install their own error handler      * to trap error and warning messages.      *      * <i>Any previously set handler is merely dropped, since the parser      * does not own them.</i>      *      * @param handler  A const pointer to the user supplied error      *                 handler.      *      * @see #getErrorHandler      */    void setErrorHandler(ErrorHandler* const handler);    /** Set the entity resolver      *      * This method allows applications to install their own entity      * resolver. By installing an entity resolver, the applications      * can trap and potentially redirect references to external      * entities.      *      * <i>Any previously set entity resolver is merely dropped, since the parser      * does not own them.  If both setEntityResolver and setXMLEntityResolver      * are called, then the last one is used.</i>      *      * @param handler  A const pointer to the user supplied entity      *                 resolver.      *      * @see #getEntityResolver      */    void setEntityResolver(EntityResolver* const handler);    /**      * Set the entity resolver      *      * This method allows applications to install their own entity      * resolver. By installing an entity resolver, the applications      * can trap and potentially redirect references to external      * entities.      *      * <i>Any previously set entity resolver is merely dropped, since the parser      * does not own them.  If both setEntityResolver and setXMLEntityResolver      * are called, then the last one set is used.</i>      *      * @param handler  A const pointer to the user supplied entity      *                 resolver.      *      * @see #getXMLEntityResolver      */    void setXMLEntityResolver(XMLEntityResolver* const handler);    /** Set the 'Grammar caching' flag      *      * This method allows users to enable or disable caching of grammar when      * parsing XML documents. When set to true, the parser will cache the      * resulting grammar for use in subsequent parses.      *      * If the flag is set to true, the 'Use cached grammar' flag will also be      * set to true.      *      * The parser's default state is: false.      *      * @param newState The value specifying whether we should cache grammars      *                 or not.      *      * @see #isCachingGrammarFromParse      * @see #useCachedGrammarInParse      */    void cacheGrammarFromParse(const bool newState);    /** Set the 'Use cached grammar' flag      *      * This method allows users to enable or disable the use of cached      * grammars.  When set to true, the parser will use the cached grammar,      * instead of building the grammar from scratch, to validate XML      * documents.      *      * If the 'Grammar caching' flag is set to true, this mehod ignore the      * value passed in.      *      * The parser's default state is: false.      *      * @param newState The value specifying whether we should use the cached      *                 grammar or not.      *      * @see #isUsingCachedGrammarInParse      * @see #cacheGrammarFromParse      */    void useCachedGrammarInParse(const bool newState);    /** Set the 'ignore cached DTD grammar' flag      *      * This method gives users the option to ignore a cached DTD grammar, when      * an XML document contains both an internal and external DTD, and the use      * cached grammar from parse option is enabled. Currently, we do not allow      * using cached DTD grammar when an internal subset is present in the      * document. This option will only affect the behavior of the parser when      * an internal and external DTD both exist in a document (i.e. no effect      * if document has no internal subset).      *      * The parser's default state is false      *      * @param newValue The state to set      */    void setIgnoreCachedDTD(const bool newValue);    //@}    // -----------------------------------------------------------------------    //  Utility methods    // -----------------------------------------------------------------------    /** @name Utility methods */    //@{    /** Reset the documents vector pool and release all the associated memory      * back to the system.      *      * When parsing a document using a DOM parser, all memory allocated      * for a DOM tree is associated to the DOM document.      *      * If you do multiple parse using the same DOM parser instance, then      * multiple DOM documents will be generated and saved in a vector pool.      * All these documents (and thus all the allocated memory)      * won't be deleted until the parser instance is destroyed.      *      * If you don't need these DOM documents anymore and don't want to      * destroy the DOM parser instance at this moment, then you can call this method      * to reset the document vector pool and release all the allocated memory      * back to the system.      *      * It is an error to call this method if you are in the middle of a      * parse (e.g. in the mid of a progressive parse).      *      * @exception IOException An exception from the parser if this function      *            is called when a parse is in progress.      *      */    void resetDocumentPool();    //@}    // -----------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -