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

📄 saxparser.hpp

📁 开源xml解析库,非常有名
💻 HPP
📖 第 1 页 / 共 5 页
字号:
    (        const   InputSource&    source        ,       XMLPScanToken&  toFill    );    /** Continue a progressive parse operation      *      * This method is used to continue with progressive parsing of      * XML files started by a call to 'parseFirst' method.      *      * It parses the XML file and stops as soon as it comes across      * a XML token (as defined in the XML specification). Relevant      * callback handlers are invoked as required by the SAX      * specification.      *      * @param token A token maintaing state information to maintain      *              internal consistency between invocation of 'parseNext'      *              calls.      *      * @return 'true', if successful in parsing the next XML token.      *         It indicates the user can go ahead with parsing the rest      *         of the file. It returns 'false' to indicate that the parser      *         could not find next token as per the XML specification      *         production rule.      *      * @see #parseFirst(XMLCh*,...)      * @see #parseFirst(char*,...)      * @see #parseFirst(InputSource&,...)      */    bool parseNext(XMLPScanToken& token);    /** Reset the parser after a progressive parse      *      * If a progressive parse loop exits before the end of the document      * is reached, the parser has no way of knowing this. So it will leave      * open any files or sockets or memory buffers that were in use at      * the time that the parse loop exited.      *      * The next parse operation will cause these open files and such to      * be closed, but the next parse operation might occur at some unknown      * future point. To avoid this problem, you should reset the parser if      * you exit the loop early.      *      * If you exited because of an error, then this cleanup will be done      * for you. Its only when you exit the file prematurely of your own      * accord, because you've found what you wanted in the file most      * likely.      *      * @param token A token maintaing state information to maintain      *              internal consistency between invocation of 'parseNext'      *              calls.      */    void parseReset(XMLPScanToken& token);    //@}    // -----------------------------------------------------------------------    //  Grammar preparsing interface    // -----------------------------------------------------------------------    /** @name Implementation of Grammar preparsing interface's. */    //@{    /**      * Preparse schema grammar (XML Schema, DTD, etc.) via an input source      * object.      *      * This method invokes the preparsing process on a schema grammar XML      * file specified by the SAX InputSource parameter. If the 'toCache' flag      * is enabled, the parser will cache the grammars for re-use. If a grammar      * key is found in the pool, no caching of any grammar will take place.      *      * <p><b>"Experimental - subject to change"</b></p>      *      * @param source A const reference to the SAX InputSource object which      *               points to the schema grammar file to be preparsed.      * @param grammarType The grammar type (Schema or DTD).      * @param toCache If <code>true</code>, we cache the preparsed grammar,      *                otherwise, no chaching. Default is <code>false</code>.      * @return The preparsed schema grammar object (SchemaGrammar or      *         DTDGrammar). That grammar object is owned by the parser.      *      * @exception SAXException Any SAX exception, possibly      *            wrapping another exception.      * @exception XMLException An exception from the parser or client      *            handler code.      * @exception DOMException A DOM exception as per DOM spec.      *      * @see InputSource#InputSource      */    Grammar* loadGrammar(const InputSource& source,                         const short grammarType,                         const bool toCache = false);    /**      * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL      *      * This method invokes the preparsing process on a schema grammar XML      * file specified by the file path parameter. If the 'toCache' flag      * is enabled, the parser will cache the grammars for re-use. If a grammar      * key is found in the pool, no caching of any grammar will take place.      *      * <p><b>"Experimental - subject to change"</b></p>      *      * @param systemId A const XMLCh pointer to the Unicode string which      *                 contains the path to the XML grammar file to be      *                 preparsed.      * @param grammarType The grammar type (Schema or DTD).      * @param toCache If <code>true</code>, we cache the preparsed grammar,      *                otherwise, no chaching. Default is <code>false</code>.      * @return The preparsed schema grammar object (SchemaGrammar or      *         DTDGrammar). That grammar object is owned by the parser.      *      * @exception SAXException Any SAX exception, possibly      *            wrapping another exception.      * @exception XMLException An exception from the parser or client      *            handler code.      * @exception DOMException A DOM exception as per DOM spec.      */    Grammar* loadGrammar(const XMLCh* const systemId,                         const short grammarType,                         const bool toCache = false);    /**      * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL      *      * This method invokes the preparsing process on a schema grammar XML      * file specified by the file path parameter. If the 'toCache' flag      * is enabled, the parser will cache the grammars for re-use. If a grammar      * key is found in the pool, no caching of any grammar will take place.      *      * <p><b>"Experimental - subject to change"</b></p>      *      * @param systemId A const char pointer to a native string which contains      *                 the path to the XML grammar file to be preparsed.      * @param grammarType The grammar type (Schema or DTD).      * @param toCache If <code>true</code>, we cache the preparsed grammar,      *                otherwise, no chaching. Default is <code>false</code>.      * @return The preparsed schema grammar object (SchemaGrammar or      *         DTDGrammar). That grammar object is owned by the parser.      *      * @exception SAXException Any SAX exception, possibly      *            wrapping another exception.      * @exception XMLException An exception from the parser or client      *            handler code.      * @exception DOMException A DOM exception as per DOM spec.      */    Grammar* loadGrammar(const char* const systemId,                         const short grammarType,                         const bool toCache = false);    /**      * This method allows the user to reset the pool of cached grammars.      */    void resetCachedGrammarPool();    //@}    // -----------------------------------------------------------------------    //  Implementation of the SAX Parser interface    // -----------------------------------------------------------------------    /** @name Implementation of SAX 1.0 Parser interface's. */    //@{    /**      * This method invokes the parsing process on the XML file specified      * by the InputSource parameter.      *      * @param source A const reference to the InputSource object which      *               points to the XML file to be parsed.      *      * @see Parser#parse(InputSource)      */    virtual void parse(const InputSource& source);    /**      * This method invokes the parsing process on the XML file specified by      * the Unicode string parameter 'systemId'.      *      * @param systemId A const XMLCh pointer to the Unicode string which      *                 contains the path to the XML file to be parsed.      *      * @see Parser#parse(XMLCh*)      */    virtual void parse(const XMLCh* const systemId);    /**      * This method invokes the parsing process on the XML file specified by      * the native char* string parameter 'systemId'.      *      * @param systemId A const char pointer to a native string which      *                 contains the path to the XML file to be parsed.      */    virtual void parse(const char* const systemId);    /**      * This method installs the user specified SAX Document Handler      * callback function on parser.      *      * @param handler A pointer to the document handler to be called      *                when the parser comes across 'document' events      *                as per the SAX specification.      *      * @see Parser#parse(char*)      */    virtual void setDocumentHandler(DocumentHandler* const handler);    /**      * This method installs the user specified DTD handler on the parser.      *      * @param handler A pointer to the DTD handler to be called      *                when the parser comes across 'DTD' events      *                as per the SAX specification.      *      * @see Parser#setDTDHandler      */    virtual void setDTDHandler(DTDHandler* const handler);    /**      * This method installs the user specified error handler on      * the parser.      *      * @param handler A pointer to the error handler to be called      *                when the parser comes across 'error' events      *                as per the SAX specification.      *      * @see Parser#setErrorHandler      */    virtual void setErrorHandler(ErrorHandler* const handler);    /**      * This method installs the user specified PSVI handler on      * the parser.      *      * @param handler A pointer to the PSVI handler to be called      *                when the parser comes across 'PSVI' events      *                as per the schema specification.      *      * @see Parser#setPSVIHandler      */    virtual void setPSVIHandler(PSVIHandler* const handler);    /**      * This method installs the user specified entity resolver on the      * parser. It allows applications to trap and redirect calls 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 resolver A pointer to the entity resolver to be called      *                 when the parser comes across references to      *                 entities in the XML file.      *      * @see Parser#setEntityResolver      */    virtual void setEntityResolver(EntityResolver* const resolver);    /**      * This method installs the user specified entity resolver on the      * parser. It allows applications to trap and redirect calls 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 resolver A pointer to the entity resolver to be called      *                 when the parser comes across references to      *                 entities in the XML file.      *      * @see Parser#setXMLEntityResolver      */    virtual void setXMLEntityResolver(XMLEntityResolver* const resolver);    //@}    // -----------------------------------------------------------------------    //  Implementation of the XMLDocumentHandler interface    // -----------------------------------------------------------------------    /** @name Implementation of the XMLDocumentHandler Interface. */    //@{    /**      * This method is used to report all the characters scanned      * by the parser. The driver will invoke the 'characters'      * method of the user installed SAX Document Handler.      *      * <p>If any advanced callback handlers are installed, the      * corresponding 'docCharacters' method will also be invoked.</p>      *      * @param chars   A const pointer to a Unicode string representing the      *                character data.      * @param length  The length of the Unicode string returned in 'chars'.      * @param cdataSection  A flag indicating if the characters represent      *                      content from the CDATA section.      * @see DocumentHandler#characters      */    virtual void docCharacters    (        const   XMLCh* const    chars        , const unsigned int    length        , const bool            cdataSection    );    /**      * This method is used to report any comments scanned by the parser.      * This method is a no-op unless, unless an advanced callback handler      * is installed, in which case the corresponding 'docComment' method      * is invoked.      *      * @param comment A const pointer to a null terminated Unicode      *                string representing the comment text.      */    virtual void docComment    (        const   XMLCh* const    comment    );    /**      * This method is used to report any PI scanned by the parser.      *      * <p>Any PI's occurring before any 'content' are not reported      * to any SAX handler as per the specification. However, all      * PI's within content are reported via the SAX Document Handler's      * 'processingInstruction' method.      *      * <p>If any advanced callback handlers are installed, the      * corresponding 'docPI' method will be invoked.</p>      *      * @param target A const pointer to a Unicode string representing the      *               target of the PI declaration.      * @param data   A const pointer to a Unicode string representing the      *               data of the PI declaration. See the PI production rule      *               in the XML specification for details.      *      * @see DocumentHandler#processingInstruction      */    virtual void docPI    (        const   XMLCh* const    target        , const XMLCh* const    data    );

⌨️ 快捷键说明

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