📄 dombuilderimpl.hpp
字号:
* <p><b>"Experimental - subject to change"</b></p> * * Query whether setting a feature to a specific value is supported. * * @param name The feature name. * @param state The requested state of the feature (true or false). * @return <code>true</code> if the feature could be successfully set * to the specified value, or <code>false</code> if the feature * is not recognized or the requested value is not supported. The * value of the feature itself is not changed. * * @see #getFeature * @see #setFeature */ bool canSetFeature(const XMLCh* const name, const bool state) const; //@} // ----------------------------------------------------------------------- // Parsing methods // ----------------------------------------------------------------------- /** @name Parsing methods */ //@{ /** * <p><b>"Experimental - subject to change"</b></p> * * Parse via an input source object * * This method invokes the parsing process on the XML file specified * by the DOMInputSource parameter. This API is borrowed from the * SAX Parser interface. * * @param source A const reference to the DOMInputSource object which * points to the XML file to be parsed. * @return If the DOMBuilder is a synchronous DOMBuilder the newly created * and populated Document is returned. If the DOMBuilder is * asynchronous then <code>null</code> is returned since the * document object is not yet parsed when this method returns. * @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 DOMInputSource#DOMInputSource * @see #setEntityResolver * @see #setErrorHandler */ DOMDocument* parse(const DOMInputSource& source); /** * <p><b>"Experimental - subject to change"</b></p> * * Parse via a file path or URL * * 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. * @return If the DOMBuilder is a synchronous DOMBuilder the newly created * and populated Document is returned. If the DOMBuilder is * asynchronous then <code>null</code> is returned since the * document object is not yet parsed when this method returns. * @exception SAXException Any SAX exception, possibly * wrapping another exception. * @exception XMLException An exception from the parser or client * handler code. * @exception DOM_DOMException A DOM exception as per DOM spec. * * @see #parse(DOMInputSource,...) */ DOMDocument* parseURI(const XMLCh* const systemId); /** * <p><b>"Experimental - subject to change"</b></p> * * Parse via a file path or URL (in the local code page) * * 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. * @return If the DOMBuilder is a synchronous DOMBuilder the newly created * and populated Document is returned. If the DOMBuilder is * asynchronous then <code>null</code> is returned since the * document object is not yet parsed when this method returns. * @exception SAXException Any SAX exception, possibly * wrapping another exception. * @exception XMLException An exception from the parser or client * handler code. * @exception DOM_DOMException A DOM exception as per DOM spec. * * @see #parse(DOMInputSource,...) */ DOMDocument* parseURI(const char* const systemId); /** * <p><b>"Experimental - subject to change"</b></p> * * Parse via an input source object * * This method invokes the parsing process on the XML file specified * by the DOMInputSource parameter, and inserts the content into an * existing document at the position specified with the contextNode * and action arguments. When parsing the input stream the context node * is used for resolving unbound namespace prefixes. * * @param source A const reference to the DOMInputSource object which * points to the XML file to be parsed. * @param contextNode The node that is used as the context for the data * that is being parsed. This node must be a Document * node, a DocumentFragment node, or a node of a type * that is allowed as a child of an element, e.g. it * can not be an attribute node. * @param action This parameter describes which action should be taken * between the new set of node being inserted and the * existing children of the context node. * @exception DOMException * NOT_SUPPORTED_ERR: Raised when the DOMBuilder doesn't support * this method. * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if the context node is * readonly. */ virtual void parseWithContext ( const DOMInputSource& source , DOMNode* const contextNode , const short action ); // ----------------------------------------------------------------------- // Non-standard Extension // ----------------------------------------------------------------------- /** @name Non-standard Extension */ //@{ /** * Query the current value of a property in a DOMBuilder. * * The builder owns the returned pointer. The memory allocated for * the returned pointer will be destroyed when the builder is deleted. * * To ensure assessiblity of the returned information after the builder * is deleted, callers need to copy and store the returned information * somewhere else; otherwise you may get unexpected result. Since the returned * pointer is a generic void pointer, see * http://xerces.apache.org/xerces-c/program-dom.html#DOMBuilderProperties to learn * exactly what type of property value each property returns for replication. * * @param name The unique identifier (URI) of the property being set. * @return The current value of the property. The pointer spans the same * life-time as the parser. A null pointer is returned if nothing * was specified externally. * @exception DOMException * <br>NOT_FOUND_ERR: Raised when the DOMBuilder does not recognize * the requested property. */ virtual void* getProperty(const XMLCh* const name) const; /** * Set the value of any property in a DOMBuilder. * See http://xerces.apache.org/xerces-c/program-dom.html#DOMBuilderProperties for * the list of supported properties. * * It takes a void pointer as the property value. Application is required to initialize this void * pointer to a correct type. See http://xerces.apache.org/xerces-c/program-dom.html#DOMBuilderProperties * to learn exactly what type of property value each property expects for processing. * Passing a void pointer that was initialized with a wrong type will lead to unexpected result. * If the same property is set more than once, the last one takes effect. * * @param name The unique identifier (URI) of the property being set. * @param value The requested value for the property. * See http://xerces.apache.org/xerces-c/program-dom.html#DOMBuilderProperties to learn * exactly what type of property value each property expects for processing. * Passing a void pointer that was initialized with a wrong type will lead * to unexpected result. * @exception DOMException * <br>NOT_FOUND_ERR: Raised when the DOMBuilder does not recognize * the requested property. */ virtual void setProperty(const XMLCh* const name, void* value); /** * Called to indicate that this DOMBuilder is no longer in use * and that the implementation may relinquish any resources associated with it. * */ virtual void release(); /** 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. * */ virtual void resetDocumentPool(); /** * 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 DOMInputSource 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 DOMInputSource 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 DOMInputSource#DOMInputSource */ virtual Grammar* loadGrammar(const DOMInputSource& 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. */ virtual 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. */ virtual Grammar* loadGrammar(const char* const systemId, const short grammarType, const bool toCache = false); /** * Retrieve the grammar that is associated with the specified namespace key * * @param nameSpaceKey Namespace key * @return Grammar associated with the Namespace key. */ virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey) const; /** * Retrieve the grammar where the root element is declared. * * @return Grammar where root element declared */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -