📄 dombuilder.hpp
字号:
#ifndef DOMBuilder_HEADER_GUARD_#define DOMBuilder_HEADER_GUARD_/* * The Apache Software License, Version 1.1 * * Copyright (c) 2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Xerces" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache\@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation, and was * originally based on software copyright (c) 2001, International * Business Machines, Inc., http://www.ibm.com . For more information * on the Apache Software Foundation, please see * <http://www.apache.org/>. *//* * $Id: DOMBuilder.hpp,v 1.11 2003/03/07 19:58:58 tng Exp $ * */#include <xercesc/util/XercesDefs.hpp>XERCES_CPP_NAMESPACE_BEGINclass DOMErrorHandler;class DOMEntityResolver;class DOMInputSource;class DOMBuilderFilter;class DOMNode;class DOMDocument;class Grammar;/** * DOMBuilder provides an API for parsing XML documents and building the * corresponding DOM document tree. A DOMBuilder instance is obtained from * the DOMImplementationLS interface by invoking its createDOMBuilder method. * This implementation also allows the applications to install an error and * an entity handler (useful extensions to the DOM specification). * * @since DOM Level 3 * */class CDOM_EXPORT DOMBuilder{protected : // ----------------------------------------------------------------------- // Hidden constructors // ----------------------------------------------------------------------- /** @name Hidden constructors */ //@{ DOMBuilder() {}; //@}private: // ----------------------------------------------------------------------- // Unimplemented constructors and operators // ----------------------------------------------------------------------- /** @name Unimplemented constructors and operators */ //@{ DOMBuilder(const DOMBuilder &); DOMBuilder & operator = (const DOMBuilder &); //@}public: // ----------------------------------------------------------------------- // All constructors are hidden, just the destructor is available // ----------------------------------------------------------------------- /** @name Destructor */ //@{ /** * Destructor * */ virtual ~DOMBuilder() {}; //@} // ----------------------------------------------------------------------- // Class types // ----------------------------------------------------------------------- /** @name Public Constants */ //@{ /** * Action types for use in parseWithContext. * * <p> <code>ACTION_REPLACE</code>: * Replace the context node with the result of parsing the input source. * For this action to work the context node must be an * <code>DOMElement</code>, <code>DOMText</code>, <code>DOMCDATASection</code>, * <code>DOMComment</code>, <code>DOMProcessingInstruction</code>, or * <code>DOMEntityReference</code> node.</p> * * <p> <code>ACTION_APPEND</code>: * Append the result of parsing the input source to the context node. For * this action to work, the context node must be an <code>DOMElement</code>.</p> * * <p> <code>ACTION_INSERT_AFTER</code>: * Insert the result of parsing the input source after the context node. * For this action to work the context nodes parent must be an * <code>DOMElement</code>.</p> * * <p> <code>ACTION_INSERT_BEFORE</code>: * Insert the result of parsing the input source before the context node. * For this action to work the context nodes parent must be an * <code>DOMElement</code>.</p> * * @see parseWithContext(...) * @since DOM Level 3 */ enum ActionType { ACTION_REPLACE = 1, ACTION_APPEND_AS_CHILDREN = 2, ACTION_INSERT_AFTER = 3, ACTION_INSERT_BEFORE = 4 }; //@} // ----------------------------------------------------------------------- // Virtual DOMBuilder interface // ----------------------------------------------------------------------- /** @name Functions introduced in DOM Level 3 */ //@{ // ----------------------------------------------------------------------- // 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. * * <p><b>"Experimental - subject to change"</b></p> * * @return The pointer to the installed error handler object. * @since DOM Level 3 */ virtual DOMErrorHandler* getErrorHandler() = 0; /** * 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. * * <p><b>"Experimental - subject to change"</b></p> * * @return A const pointer to the installed error handler object. * @since DOM Level 3 */ virtual const DOMErrorHandler* getErrorHandler() const = 0; /** * 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. * * <p><b>"Experimental - subject to change"</b></p> * * @return The pointer to the installed entity resolver object. * @since DOM Level 3 */ virtual DOMEntityResolver* getEntityResolver() = 0; /** * 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. * * <p><b>"Experimental - subject to change"</b></p> * * @return A const pointer to the installed entity resolver object. * @since DOM Level 3 */ virtual const DOMEntityResolver* getEntityResolver() const = 0; /** * Get a pointer to the application filter * * This method returns the installed application filter. If no filter * has been installed, then it will be a zero pointer. * * <p><b>"Experimental - subject to change"</b></p> * * @return The pointer to the installed application filter. * @since DOM Level 3 */ virtual DOMBuilderFilter* getFilter() = 0; /** * Get a const pointer to the application filter * * This method returns the installed application filter. If no filter * has been installed, then it will be a zero pointer. * * <p><b>"Experimental - subject to change"</b></p> * * @return A const pointer to the installed application filter * @since DOM Level 3 */ virtual const DOMBuilderFilter* getFilter() const = 0; // ----------------------------------------------------------------------- // 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> * * <p><b>"Experimental - subject to change"</b></p> * * @param handler A const pointer to the user supplied error * handler. * * @see #getErrorHandler * @since DOM Level 3 */ virtual void setErrorHandler(DOMErrorHandler* const handler) = 0; /** * 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 resolver is merely dropped, since the parser * does not own them.</i> * * <p><b>"Experimental - subject to change"</b></p> * * @param handler A const pointer to the user supplied entity * resolver. * * @see #getEntityResolver * @since DOM Level 3 */ virtual void setEntityResolver(DOMEntityResolver* const handler) = 0; /** * Set the application filter * * When the application provides a filter, the parser will call out to * the filter at the completion of the construction of each Element node. * The filter implementation can choose to remove the element from the * document being constructed (unless the element is the document element) * or to terminate the parse early. If the document is being validated * when it's loaded the validation happens before the filter is called. * * <i>Any previously set filter is merely dropped, since the parser * does not own them.</i> * * <p><b>"Experimental - subject to change"</b></p> * * @param filter A const pointer to the user supplied application * filter. * * @see #getFilter * @since DOM Level 3 */ virtual void setFilter(DOMBuilderFilter* const filter) = 0; // ----------------------------------------------------------------------- // Feature methods // ----------------------------------------------------------------------- /** * Set the state of a feature * * It is possible for a DOMBuilder to recognize a feature name but to be * unable to set its value. * * <p><b>"Experimental - subject to change"</b></p> * * See http://xml.apache.org/xerces-c/program-dom.html#DOMBuilderFeatures for * the list of supported features. * * @param name The feature name. * @param state The requested state of the feature (true or false). * @exception DOMException * NOT_SUPPORTED_ERR: Raised when the DOMBuilder recognizes the * feature name but cannot set the requested value. * <br>NOT_FOUND_ERR: Raised when the DOMBuilder does not recognize * the feature name. * * @see #setFeature * @see #canSetFeature * @since DOM Level 3 */ virtual void setFeature(const XMLCh* const name, const bool state) = 0; /** * Look up the value of a feature. * * <p><b>"Experimental - subject to change"</b></p> * * @param name The feature name. * @return The current state of the feature (true or false) * @exception DOMException * NOT_FOUND_ERR: Raised when the DOMBuilder does not recognize * the feature name. * * @see #getFeature * @see #canSetFeature * @since DOM Level 3 */ virtual bool getFeature(const XMLCh* const name) const = 0; /**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -