📄 dombuilderimpl.hpp
字号:
/* * 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: DOMBuilderImpl.hpp 569031 2007-08-23 15:05:28Z amassari $ * */#if !defined(DOMBUILDERIMPL_HPP)#define DOMBUILDERIMPL_HPP#include <xercesc/parsers/AbstractDOMParser.hpp>#include <xercesc/dom/DOMBuilder.hpp>#include <xercesc/util/XercesDefs.hpp>XERCES_CPP_NAMESPACE_BEGINclass XMLEntityResolver;class XMLResourceIdentifier; /** * Introduced in DOM Level 3 * * DOMBuilderImpl provides an implementation of a DOMBuilder interface. * A DOMBuilder instance is obtained from the DOMImplementationLS interface * by invoking its createDOMBuilder method. */class PARSERS_EXPORT DOMBuilderImpl : public AbstractDOMParser, public DOMBuilder{public : // ----------------------------------------------------------------------- // Constructors and Detructor // ----------------------------------------------------------------------- /** @name Constructors and Destructor */ //@{ /** Construct a DOMBuilderImpl, 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. */ DOMBuilderImpl ( XMLValidator* const valToAdopt = 0 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager , XMLGrammarPool* const gramPool = 0 ); /** * Destructor */ virtual ~DOMBuilderImpl(); //@} // ----------------------------------------------------------------------- // Implementation of DOMBuilder interface // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- // Getter methods // ----------------------------------------------------------------------- /** @name Getter methods */ //@{ /** * <p><b>"Experimental - subject to change"</b></p> * * 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. */ DOMErrorHandler* getErrorHandler(); /** * <p><b>"Experimental - subject to change"</b></p> * * 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 DOMErrorHandler* getErrorHandler() const; /** * <p><b>"Experimental - subject to change"</b></p> * * 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. */ DOMEntityResolver* getEntityResolver(); /** * 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; /** * <p><b>"Experimental - subject to change"</b></p> * * 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 DOMEntityResolver* getEntityResolver() const; /** * <p><b>"Experimental - subject to change"</b></p> * * 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. * * @return The pointer to the installed application filter. */ DOMBuilderFilter* getFilter(); /** * <p><b>"Experimental - subject to change"</b></p> * * 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. * * @return A const pointer to the installed application filter */ const DOMBuilderFilter* getFilter() const; //@} // ----------------------------------------------------------------------- // Setter methods // ----------------------------------------------------------------------- /** @name Setter methods */ //@{ /** * <p><b>"Experimental - subject to change"</b></p> * * 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(DOMErrorHandler* const handler); /** * <p><b>"Experimental - subject to change"</b></p> * * 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(DOMEntityResolver* 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 #getXMLEntityResolver */ void setXMLEntityResolver(XMLEntityResolver* const handler); /** * <p><b>"Experimental - subject to change"</b></p> * * 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> * * @param filter A const pointer to the user supplied application * filter. * * @see #getFilter */ void setFilter(DOMBuilderFilter* const filter); //@} // ----------------------------------------------------------------------- // Feature methods // ----------------------------------------------------------------------- /** @name Feature methods */ //@{ /** * <p><b>"Experimental - subject to change"</b></p> * * 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. * * @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 #getFeature * @see #canSetFeature */ void setFeature(const XMLCh* const name, const bool state); /** * <p><b>"Experimental - subject to change"</b></p> * * Look up the value of a feature. * * @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 #setFeature * @see #canSetFeature */ bool getFeature(const XMLCh* const name) const; /**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -